diff options
author | António Fernandes <antoniof@gnome.org> | 2021-12-22 10:55:15 +0000 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2022-01-01 22:04:06 +0000 |
commit | 451e5aa9febf049ada77eddfc5925b9cb7425f5b (patch) | |
tree | 6742ecd84e842045f102b6f9f87c522f568f112e | |
parent | 0e8c0ac3a4a80a1ba8b98b4b2ad102f9df489d56 (diff) | |
download | nautilus-451e5aa9febf049ada77eddfc5925b9cb7425f5b.tar.gz |
toolbar: Don't rely on ::toggled in GtkMenuButton
In GTK 4, GtkMenuButton is not a subclass of GtkToggleButton, so it
won't inherit this signal.
Instead, listen to :visible in the popover.
-rw-r--r-- | src/nautilus-toolbar.c | 9 | ||||
-rw-r--r-- | src/resources/ui/nautilus-toolbar.ui | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c index 7148427ac..c6f03517c 100644 --- a/src/nautilus-toolbar.c +++ b/src/nautilus-toolbar.c @@ -650,10 +650,11 @@ on_operations_icon_draw (GtkWidget *widget, } static void -on_operations_button_toggled (NautilusToolbar *self, - GtkToggleButton *button) +on_operations_popover_notify_visible (NautilusToolbar *self, + GParamSpec *pspec, + GObject *popover) { - if (gtk_toggle_button_get_active (button)) + if (gtk_widget_get_visible (GTK_WIDGET (popover))) { unschedule_remove_finished_operations (self); nautilus_progress_manager_add_viewer (self->progress_manager, @@ -1142,7 +1143,7 @@ nautilus_toolbar_class_init (NautilusToolbarClass *klass) gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, search_button); gtk_widget_class_bind_template_callback (widget_class, on_operations_icon_draw); - gtk_widget_class_bind_template_callback (widget_class, on_operations_button_toggled); + gtk_widget_class_bind_template_callback (widget_class, on_operations_popover_notify_visible); } GtkWidget * diff --git a/src/resources/ui/nautilus-toolbar.ui b/src/resources/ui/nautilus-toolbar.ui index 8bb25bf2e..c1d12eefe 100644 --- a/src/resources/ui/nautilus-toolbar.ui +++ b/src/resources/ui/nautilus-toolbar.ui @@ -134,6 +134,7 @@ </child> </object> </child> + <signal name="notify::visible" handler="on_operations_popover_notify_visible" object="NautilusToolbar" swapped="yes"/> </object> <template class="NautilusToolbar" parent="GtkBin"> <property name="visible">True</property> @@ -295,7 +296,6 @@ <property name="tooltip_text" translatable="yes">Show operations</property> <property name="margin_end">6</property> <property name="popover">operations_popover</property> - <signal name="toggled" handler="on_operations_button_toggled" object="NautilusToolbar" swapped="yes"/> <child> <object class="GtkDrawingArea" id="operations_icon"> <property name="width_request">16</property> |