[nautilus/gtk4-preparation-trunk: 25/36] toolbar: Don't rely on ::toggled in GtkMenuButton
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/gtk4-preparation-trunk: 25/36] toolbar: Don't rely on ::toggled in GtkMenuButton
- Date: Sat, 1 Jan 2022 22:04:22 +0000 (UTC)
commit 451e5aa9febf049ada77eddfc5925b9cb7425f5b
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 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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]