[nautilus/wip/antoniof/gtk4-preparation-popovers: 7/17] toolbar: Don't rely on ::toggled in GtkMenuButton
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/gtk4-preparation-popovers: 7/17] toolbar: Don't rely on ::toggled in GtkMenuButton
- Date: Fri, 31 Dec 2021 14:34:58 +0000 (UTC)
commit 050751323a34cd4289a4f314bc6b6ce136c8c2f0
Author: António Fernandes <antoniof gnome org>
Date: Wed Dec 22 10:55:15 2021 +0000
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.
src/nautilus-toolbar.c | 9 +++++----
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 f472f8d80..461cd8627 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,
@@ -1158,7 +1159,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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]