[nautilus] toolbar: Prevent closing popover when "Show Hidden Files" is toggled



commit bf7b487eb976abe5f036005f56e74ed7a05a1598
Author: Rodrigo Pedro <rodrigoresendespedro gmail com>
Date:   Fri Jun 25 16:12:00 2021 +0100

    toolbar: Prevent closing popover when "Show Hidden Files" is toggled
    
    When the "Show Hidden Files" check button is toggled, the popover is closed,
    however, when the "Show Sidebar" check button is toggled, the popover stays
    opened. This is inconsistent and the popover should stay open in all cases.
    This happens because of a bug in the `nautilus_toolbar_is_menu_visible`
    function implementation, which is checking the visibility of the `view_button`
    popover instead of the `app_menu` popover. Let's check the visibility of the
    correct popover to fix this inconsistency.
    
    Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1827

 src/nautilus-toolbar.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index 31b67bb2f..7b1fa07f2 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -91,6 +91,8 @@ struct _NautilusToolbar
     GtkWidget *view_toggle_button;
     GtkWidget *view_toggle_icon;
 
+    GtkWidget *app_menu;
+
     GtkWidget *operations_popover;
     GtkWidget *operations_container;
     GtkWidget *operations_revealer;
@@ -1230,6 +1232,7 @@ nautilus_toolbar_class_init (NautilusToolbarClass *klass)
     gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, view_button);
     gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, view_toggle_button);
     gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, view_toggle_icon);
+    gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, app_menu);
     gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, back_button);
     gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, forward_button);
     gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, toolbar_switcher_container);
@@ -1502,13 +1505,9 @@ nautilus_toolbar_set_window_slot (NautilusToolbar    *self,
 gboolean
 nautilus_toolbar_is_menu_visible (NautilusToolbar *self)
 {
-    GtkPopover *popover;
-
     g_return_val_if_fail (NAUTILUS_IS_TOOLBAR (self), FALSE);
 
-    popover = GTK_POPOVER (gtk_menu_button_get_popover (GTK_MENU_BUTTON (self->view_button)));
-
-    return gtk_widget_is_visible (GTK_WIDGET (popover));
+    return gtk_widget_is_visible (self->app_menu);
 }
 
 gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]