Commit Graph

35055 Commits

Author SHA1 Message Date
Matthias Clasen
ee1f8d8d06 popover: Derive from GtkWidget 2020-05-04 22:53:07 -04:00
Matthias Clasen
8e261056b9 Use gtk_popover_set_child throughout
Replace all uses of gtk_container_add on popovers
by gtk_popover_set_child.
2020-05-04 22:53:07 -04:00
Matthias Clasen
ee284a560a popover: Add a child property 2020-05-04 17:01:18 -04:00
Matthias Clasen
e098ffb88d viewport: Derive from GtkWidget
We want to remove GtkBin and GtkContainer as they don't
provide much useful functionality anymore. This requires
us to move get_request_mode and compute_expand down.

We have to implement GtkBuildable in order to keep
the <child> element working for viewports in ui files.
See #2681
2020-05-04 17:01:18 -04:00
Matthias Clasen
e9ddf0fda5 Use gtk_viewport_set_child throughout
Replace all uses of gtk_container_add on viewports
by gtk_viewport_set_child.
2020-05-04 17:01:18 -04:00
Matthias Clasen
937c94bab5 viewport: Add a child property 2020-05-04 17:01:18 -04:00
Matthias Clasen
5b06b08a0e aspectframe: Derive from GtkWidget
We want to remove GtkBin and GtkContainer as they don't
provide much useful functionality anymore. This requires
us to move get_request_mode and compute_expand down.

We have to implement GtkBuildable, in order to keep
the <child> element in ui files working for aspect
frames.

See #2681
2020-05-04 17:01:18 -04:00
Matthias Clasen
e137152520 aspectframe: Add a child property 2020-05-04 17:01:18 -04:00
Matthias Clasen
25826eafe3 frame: Derive from GtkWidget
We want to remove GtkBin and GtkContainer as they don't
provide much useful functionality anymore. This requires
us to move get_request_mode and compute_expand down.

See #2681
2020-05-04 17:01:18 -04:00
Matthias Clasen
1706b80815 Use gtk_frame_set_child throughout
Replace all uses of gtk_container_add for
frames with gtk_frame_set_child.
2020-05-04 17:01:18 -04:00
Matthias Clasen
7f975472a7 frame: Add a child property 2020-05-04 17:01:18 -04:00
Matthias Clasen
8c1072fad1 Merge branch 'wip/jimmac/notebook-focus' into 'master'
Adwaita: notebook tab focus

See merge request GNOME/gtk!1825
2020-05-04 20:10:46 +00:00
Matthias Clasen
188a61f02d Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!1826
2020-05-04 19:02:40 +00:00
Jakub Steiner
9dfac6fe3f Adwaita: colorswatch focus rings
- there used to be different outline color for light and dark buttons,
  but it's complexity I can live without. blue focus rings fit all.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2695
2020-05-04 18:16:08 +02:00
Jakub Steiner
a3f042b5b4 Adwaita: notebook tab focus
- just like entries tabs need to be handled with focus-within
2020-05-04 17:54:12 +02:00
Matthias Clasen
53d86d411a Adwaita: Style .toolbar
We don't have GtkToolbar anymore, so we are more likely
to meet a .toolbar style class, than a toolbar element.
2020-05-04 10:51:11 -04:00
Alexander Mikhaylenko
d2b5beffbf Adwaita: Convert entries to the new focus rings 2020-05-04 19:24:24 +05:00
Matthias Clasen
837b141747 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!1823
2020-05-04 12:31:25 +00:00
Matthias Clasen
130ae89e54 frame: Fix xalign handling
SEtting a nonzero xalign on frames had no
effect, since we were always using the full
allocation with here, instead of what the label
needs. Found by using testframe for a second.
2020-05-04 07:37:31 -04:00
Matthias Clasen
77cf6cd406 frame: Don't queue a resize if xalign changes
We only need to allocate children in this case.
While we touch it, rewrite the setter to modern
style.
2020-05-04 07:37:25 -04:00
Jakub Steiner
8127d70b8a Adwaita: make transition offset more subtle
- be less like wobbly windows
2020-05-04 11:29:19 +02:00
Jakub Steiner
ab0ad4a0d7 Merge branch 'wip/jimmac/emphasize-focus-change' into 'master'
Adwaita: bring more attention to focus change

See merge request GNOME/gtk!1803
2020-05-04 08:49:40 +00:00
Matthias Clasen
b4d5ddcae5 Merge branch 'filechooser-translation' into 'master'
filechooser: Translate type column

Closes #2690

See merge request GNOME/gtk!1816
2020-05-03 01:10:24 +00:00
Matthias Clasen
817112ab3c filechooser: Translate type column
When the code for this was copied from nautilus,
we forgot to adapt it for running in a library
instead of an application - gettext() doesn't work
in a library.

Fixes: #2690
2020-05-02 19:57:38 -04:00
Alexander Mikhaylenko
80867acf94 appchooserdialog: Don't show subtitle label when subtitle is null
Looks like 67822d0c9a and
3f1bd3722d collided, and subtitle can be null
now. Add a check so that we don't end up with empty label in that case.
2020-05-02 23:35:44 +05:00
Matthias Clasen
fd1fe0eed5 Merge branch 'matthiasc/for-master' into 'master'
docs: Add more detail to the drawing overview

See merge request GNOME/gtk!1811
2020-05-01 21:09:38 +00:00
Benjamin Otte
fa90747815 Merge branch 'wip/exalm/headerbar-title' into 'master'
Headerbar title/subtitle cleanups

See merge request GNOME/gtk!1807
2020-05-01 19:39:27 +00:00
Matthias Clasen
8653a5e27b dragicon: Derive from GtkWidget
This wasn't meant to derive from GtkContainer.
2020-05-01 14:24:21 -04:00
Alexander Mikhaylenko
ab59562170 headerbar: Document GtkBuilder child types, add a title example 2020-05-01 21:39:32 +05:00
Florian Müllner
3f1bd3722d appchooserdialog: Don't show broken subtitles
Commit 07beb6dba2 made GtkAppChooserWidget useful with no content-type,
however when used in a GtkAppChooserDialog, this will lead to a confusing
"Opening (null) files" subtitle.

Fix this by omitting the subtitle altogether in that case.
2020-05-01 18:21:53 +02:00
Alexander Mikhaylenko
6b4bed2c7a builder-tool: Rename GtkHeaderBar:custom-title to title-widget
Add a test.
2020-05-01 20:11:19 +05:00
Alexander Mikhaylenko
739f681076 headerbar: Rename custom-title to title-widget
Now that all the other title-related properties are gone, custom title can
have a more mundane name.
2020-05-01 20:11:19 +05:00
Alexander Mikhaylenko
c2e4e1af73 headerbar: Remove user-settable title
Use window title, or custom title widget if it's set. Remove 'title'
property.

Update demos and tests to set the title on the window instead of
headerbar.
2020-05-01 19:48:05 +05:00
Alexander Mikhaylenko
35d50f88c8 headerbar: Remove subtitle
Also remove the box containing title and subtitle, as there's only one
label now.
2020-05-01 19:48:05 +05:00
Alexander Mikhaylenko
fa0509c473 filechooserdialog: Create title and subtitle manually
title and subtitle properties will go away in the following commits, stop
using them.
2020-05-01 19:48:05 +05:00
Alexander Mikhaylenko
67822d0c9a appchooserdialog: Create title and subtitle manually
title and subtitle properties will go away in the following commits, stop
using them.
2020-05-01 19:48:05 +05:00
Alexander Mikhaylenko
43a453e465 headerbar: Remove has-subtitle property
Subtitle will go too in the next commit, but has-subtitle goes first as
it's broken right now anyway.
2020-05-01 19:48:05 +05:00
Matthias Clasen
cb056a1e8f stack: Add a :use-underline property
Add GtkStackPage:use-underline, and use it when
constructing labels in the stack switcher.
2020-04-30 19:17:34 -04:00
Jakub Steiner
8165616b3c Adwaita: bring more attention to focus change
- as discussed in https://gitlab.gnome.org/GNOME/gtk/-/issues/2644 it's desirable to bring attention to what's focused. Instead of pressing `alt` just simply changing focus with `tab` can have a similar effect

Extends https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/1802
2020-05-01 00:14:44 +02:00
nana-4
2fa876e839 Adwaita: Use a mixin for visible focus rings
The focus-ring() mixin allows we to flexibly style the focus ring for
each widget. By using this, we can get rid of the "Outlines" section,
which is out of place in the _common.scss file.

This commit also has the following changes:

- Transition the focus rings on most widgets.
- Add a missing focus ring to iconview.
- Move the expander-widget focus ring to its title.
- Move the notebook focus ring to its checked tab.

Closes https://gitlab.gnome.org/GNOME/gtk/-/issues/2653
2020-05-01 02:03:23 +09:00
Matthias Clasen
3bbcaa9e8f docs: Move menu model docs
It makes more sense to document the menu model XML
format in the GtkPopoverMenu docs than in
GtkApplicationWindow.
2020-04-29 20:30:40 -04:00
Matthias Clasen
91d8c230f3 popover: Fix repositioning logic
When the arrow changes position, we need to queue
an allocation to ensure that gtk_widget_allocate
actually calls our ->size_allocate vfunc.
2020-04-28 23:26:19 -04:00
Matthias Clasen
b47e721ab6 Merge branch 'class-action-init' into 'master'
Reshuffle action muxer initialization

See merge request GNOME/gtk!1789
2020-04-29 02:04:37 +00:00
Matthias Clasen
c4a47e218f Speed up class action hookup
No need to construct a detailed signal name for
every action when we can just look up the signal ID
once and use the quark that the GParamSpec already
has. Also, we don't need to loop over the actions
every time we get a notification.
2020-04-28 20:22:26 -04:00
Matthias Clasen
2e2121c7ad builder-tool: Replace GtkStack:homogeneous
Replace this property by h/vhomogeneous.

Add a test.
2020-04-28 20:00:51 -04:00
Matthias Clasen
5f01f6f36b Drop GtkStack:homogeneous
We have hhomogeneous and vhomogeneous properties
that can be set individually.

Fixes: #2673
2020-04-28 20:00:12 -04:00
Matthias Clasen
b968ced567 Reshuffle action muxer initialization
We were having a problem where property actions were
not getting state updates because prop_actions_connect
was triggered from some instance_init function while
the widget class is not in place yet.

Delay that call until the widget is fully constructed,
so we can guarantee that we are dealing with the
correct class private struct, and see all class actions.
2020-04-28 18:37:43 -04:00
Matthias Clasen
dc7081599d video: Don't hide the controls while the popup is shown
We don't get motion events from the popup (due to grabs),
so just don't hide as long as we're grab shadowed. This
makes the controls stay up until the volume popup is
dismissed.
2020-04-28 15:11:26 -04:00
Emmanuele Bassi
65c56ea812 Merge branch 'drop-realize-invariant' into 'master'
Drop parent->realized => child->realized invariant

See merge request GNOME/gtk!1783
2020-04-28 14:11:55 +00:00
Alexander Larsson
c6104fe7fd Drop parent->realized => child->realized invariant
We already dropped this invariant in gtk_widget_verify_invariants()
because it was not true in all cases. Also, it is not really useful
these days as we extended what it means to be a "child" to also
include widgets in different toplevels.

For example, a popup in a popup button need not be realized just
because the button is in a realized window. The main invariants
we want are:

 * Parent is realized before child
 * Widget is realized before it is mapped

This sounds like its not a huge deal, but in fact it is a massive win
for things like menus, because when we go between menus in a menubar
each switch between two open menus involves a lot of intermingled
crossing events to different surfaces and for each of these the
tooltip window of the toplevel gets assigned to the new surface.  This
shouldn't be a huge deal, as the tooltip window is not even visible,
but due to the realized invariant it get re-realized each time it gets
re-assigned.
2020-04-28 14:32:57 +02:00
Emmanuele Bassi
555230ec9c Annotate more functions returning GListModel
Now that we can have an element-type annotation, we should use it where
needed.
2020-04-28 13:31:59 +01:00
Emmanuele Bassi
2a11f5f889 Use attributes instead of element-type annotation
The `element-type` annotation is for GList and GSList only, and turns
out adding support for GListModel in gobject-introspection breaks Vala
and the GIR for GIO.

Instead of using `element-type`, we can use the `attributes` annotation,
which is ignored by code generators based on the GIR data.
2020-04-28 13:31:29 +01:00
Matthias Clasen
5477c1cdfe inspector: Show the media backend 2020-04-28 00:37:54 -04:00
Matthias Clasen
75c75e001c mediafile: Privately export function to the extension
We want to show this information in the inspector.
2020-04-28 00:37:54 -04:00
Matthias Clasen
af32092f16 Merge branch 'popover-flip-arrow-fix' into 'master'
popover: Allocate after setting final_position

Closes #2671

See merge request GNOME/gtk!1780
2020-04-28 03:42:01 +00:00
Matthias Clasen
473709fee3 popover: Allocate after setting final_position
When we find out that we've been flipped, set
final_position and final_rect before allocating
the popover. This prevents 'smashed-in beak' disease.

Fixes: #2671
2020-04-27 20:58:03 -04:00
Matthias Clasen
a837b57849 popovermenu: Don't put a separator before the first section
When we have section titles, we were not hiding the
separator before the first section as we should;
fix this.

Fixes: #2672
2020-04-27 20:27:39 -04:00
Matthias Clasen
789586c385 Merge branch 'BUG_filechooser_async_data_loss_GTK4' into 'master'
GtkFilechooserWidget: prevent oblivious selection of file

See merge request GNOME/gtk!1688
2020-04-27 13:22:47 +00:00
Alexander Mikhaylenko
422c78badf mediacontrols: Use tabular figures for time and duration
In particular, this prevents gtk4-widget-factory from jumping every
second.
2020-04-27 17:28:20 +05:00
Matthias Clasen
b3710279bc Merge branch '2657-avoid-use-after-free-suggestion' into 'master'
Resolve "Use-after-free crash in `thaw_updates()`"

Closes #2657

See merge request GNOME/gtk!1771
2020-04-27 12:16:54 +00:00
Matthias Clasen
429e0bfaec filechooser: Correct an annotation
Clarify that gtk_file_chooser_add_filter is only taking
ownership of a floating reference, which translates to
"transfer none", not "transfer full".

Fixes: #2016
2020-04-27 00:35:47 -04:00
Matthias Clasen
fc450e313b placesview: Fix translator comments
These comments were applied to the wrong strings
by xgettext.

Fixes: #2666
2020-04-27 00:23:49 -04:00
Matthias Clasen
f18eef7e6f filechooser: Fix type-to-search
We need to capture the keys and forward them
to the search entry, for anything to happen.
2020-04-27 00:14:38 -04:00
Peter Bloomfield
b9155dcb1a file-system-model: Refactor a helper
Push more common code into the helper for
gtk_file_system_model_query_done() and
gtk_file_system_model_one_query_done().
2020-04-26 17:38:49 -04:00
Peter Bloomfield
d85f02a994 file-system-model: Avoid use-after free
This is a possible fix for https://gitlab.gnome.org/GNOME/gtk/-/issues/2657

Use a NULL return from g_file_query_info_finish() to detect cancellation
of the query, and avoid derferencing a stale pointer.
2020-04-26 16:47:23 -04:00
scootergrisen
01ebd00f97 Remove a "-" 2020-04-26 20:44:04 +00:00
Matthias Clasen
dc99a7aa61 stackswitcher: Drop the Private struct 2020-04-26 15:48:46 -04:00
Matthias Clasen
508ed21786 progressbar: Drop the Private struct 2020-04-26 15:44:44 -04:00
Matthias Clasen
2356c9b503 overlay: Drop the Private struct 2020-04-26 15:38:09 -04:00
Matthias Clasen
bf77694557 linkbutton: Drop the Private struct 2020-04-26 15:38:09 -04:00
Matthias Clasen
5bd2b49064 fontchooserdialog: Drop the Private struct 2020-04-26 15:38:09 -04:00
Matthias Clasen
a78e0f1188 fontchooserwidget: Drop the Private struct 2020-04-26 15:38:09 -04:00
Matthias Clasen
7ede3b919c calendar: Drop the Private struct 2020-04-26 15:38:09 -04:00
Matthias Clasen
2ea7f47089 separator: Drop the Private struct 2020-04-26 15:38:09 -04:00
Matthias Clasen
9156be6bf1 viewport: Drop the Private struct 2020-04-26 15:38:09 -04:00
Matthias Clasen
0b6cd34b1d Merge branch 'matthiasc/for-master' into 'master'
widget-factory improvements

See merge request GNOME/gtk!1767
2020-04-26 19:20:47 +00:00
Matthias Clasen
2dfd1404ff inspector: Make the resource tab play videos
We can do this easily, so why not. This can be
seen in action with gtk-logo.webm, e.g. in gtk4-demo.
2020-04-26 14:08:40 -04:00
Alexander Mikhaylenko
7874b29ec2 Adwaita: remove margin from GtkWindowControls when empty 2020-04-26 20:24:20 +05:00
Matthias Clasen
7f1e82d1bc Merge branch 'wip/exalm/titlebuttons' into 'master'
GtkWindowControls + GtkHeaderBar cleanups

See merge request GNOME/gtk!1755
2020-04-26 13:09:35 +00:00
Alexander Mikhaylenko
5321f8f195 headerbar: Use GtkWindowControls
Now that the title buttons are encapsulated in a separate widget, use
it in the header bar.

Hide them when empty, so that they don't add extra spacing.
2020-04-26 15:13:15 +05:00
Alexander Mikhaylenko
4aa8f6f73c Add GtkWindowControls
Move some code out of GtkHeaderBar and into a separate widget, making it
reusable in process.

See https://gitlab.gnome.org/GNOME/gtk/issues/2242
2020-04-26 15:13:15 +05:00
Matthias Clasen
637890517b Move the idle sizer to the gtkroot.c
This is needed since we already have a second GtkRoot
implementation with GtkDragIcon, and DND is causing
critical warnings due to this.
2020-04-25 21:03:57 -04:00
Matthias Clasen
b64f889cd9 fixed: Fix an oversight in size requisition
We need to take orientation into account when applying
child transforms. This is what broke the background-image-multiple
reftest.
2020-04-25 13:18:34 -04:00
Matthias Clasen
fdc4335eba menu: Dismiss submenus during keynav
We need to dismiss submenus explicitly on left arrow,
otherwise the grab interferes with our keynav.
2020-04-25 12:14:04 -04:00
Matthias Clasen
4936e7f859 Cosmetics
Reduce casting.
2020-04-25 11:54:29 -04:00
Matthias Clasen
8b64e29ba6 menu: Ignore leaves due to grabs
When we open a submenu we get a leave due to the grab,
but we don't want to unset the active item then.
2020-04-25 11:46:43 -04:00
Carlos Garnacho
2c23546ba9 gtktexthandle: Set parent through API call
The GtkWidget::parent property went readonly, use the API call
to ensure the text handle has a parent set.
2020-04-25 00:09:41 +02:00
Carlos Garnacho
9ed579505d gtktreeview: Ensure to transiently prelight on touch input
Some machinery (like clicking on expander) relies on prelight state
being up to date, but we don't set prelight on touch events. Do that
transiently, as long as a row is clicked.

Fixes tapping on expanders.
2020-04-24 23:14:51 +02:00
Carlos Garnacho
67e1acd4d7 gtkpopover: Roll back properly if presenting the popup fails
If the popover fails to be shown, it would internally undo visible
and mapped state. If we just proceed as normal, the widget enters
in inconsistent state, and a grab remains issued on the invisible
widget, preventing further input from the input device.
2020-04-24 23:06:52 +02:00
Carlos Garnacho
d104efe06e gtkwindow: Correct device check
This function to revoke implicit grabs may be called with a NULL
device, which means all devices should be revoked. Fix the check
so this actually happens.

Fixes implicit grabs (maybe) being unset in result to a GTK grab.
2020-04-24 23:04:27 +02:00
Carlos Garnacho
2a877a9be5 gtkwindowgroup: Take default group into account when listing windows
Otherwise, no windows belong to the default group, paradoxically.
2020-04-24 23:03:13 +02:00
Carlos Garnacho
777fd92eba gtkpadcontroller: Avoid filling action list with empty elements
We don't need to set the array size if we are adding elements afterwards.
2020-04-24 22:21:08 +02:00
Alexander Mikhaylenko
2791c522d8 headerbar: Remove decoration-layout-set property
It's unnecessary and only complicates the API. Use decoration-layout if
it's not NULL, and GtkSettings otherwise.
2020-04-24 23:54:07 +05:00
Alexander Mikhaylenko
18114bafe0 headerbar: Remove title button separators
They have had opacity: 0 for a while, just remove them.
2020-04-24 23:54:07 +05:00
Matthias Clasen
b2deab6adf Drop gtk_widget_has_grab
This was just a leftover in our public api.
All other grab-related apis are gone.
2020-04-23 14:10:44 -04:00
Benjamin Otte
389575ee18 Merge branch 'wip/exalm/window-headerbar' into 'master'
First steps for #2242

See merge request GNOME/gtk!1739
2020-04-23 15:26:30 +00:00
Alexander Mikhaylenko
7c4694ca3c window: Stop listening to headerbar title changes
Remove another dependency.
2020-04-23 19:26:10 +05:00
Alexander Mikhaylenko
610d5794ac headerbar: Update window buttons automatically
Update the layout when any of the following properties changes:
 * modal
 * transient-for
 * resizable
 * deletable

Stop updating it from GtkWindow, make that function static.
2020-04-23 19:26:10 +05:00
Matthias Clasen
b0f2cd02ad window: Tweak visible focus behavior
Only turn on visible focus when a key event actually leads
to a change in focus location (ie, 'keynav').

Make the visible focus disappear after 5 seconds of no
keyboard interaction, to avoid permanent focus ring
distraction.

As an extra bonus, make it so that we make the focus
visible while the Alt key is pressed. This gives us
a 'find my focus!' shortcut, and goes well with the
prexisting use of Alt for finding mnemonics.

Discussed in: #2644
2020-04-23 09:33:26 -04:00
Jakub Steiner
7fe51a876c Merge branch 'wip/jimmac/uniform-checkboxes' into 'master'
Adwaita: lower glyph contrast for checkboxes

See merge request GNOME/gtk!1745
2020-04-23 11:44:47 +00:00