[nautilus/wip/antoniof/gtk4-preparation-popovers: 53/60] 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: 53/60] toolbar: Don't rely on ::toggled in GtkMenuButton
- Date: Thu, 23 Dec 2021 01:02:38 +0000 (UTC)
commit 3349a42bf4f685ab34d178964a822bd4ffc6e696
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 4f9af2ce5..91f96a409 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -690,10 +690,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,
@@ -1198,7 +1199,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 d7089d36a..b626d6675 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>
@@ -298,7 +299,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]