[gnome-todo] window: Hide view menus when empty



commit 4158396819fdcc7d2b74370586509a963acbab03
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Sep 5 11:03:07 2018 -0300

    window: Hide view menus when empty
    
    When the view menu is empty, it doesn't make a lot of
    sense to show it. It can't be interacted. So, just hide
    it in the absence of content.

 src/gtd-window.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/gtd-window.c b/src/gtd-window.c
index 408ebc1..42e3a76 100644
--- a/src/gtd-window.c
+++ b/src/gtd-window.c
@@ -214,8 +214,12 @@ static void
 update_panel_menu (GtdWindow *self)
 {
   GtkPopover *popover;
+  const GMenu *menu;
 
   popover = gtd_panel_get_popover (self->active_panel);
+  menu = gtd_panel_get_menu (self->active_panel);
+
+  gtk_widget_set_visible (self->gear_menu_button, popover || menu);
 
   if (popover)
     {
@@ -223,10 +227,6 @@ update_panel_menu (GtdWindow *self)
     }
   else
     {
-      const GMenu *menu;
-
-      menu = gtd_panel_get_menu (self->active_panel);
-
       gtk_menu_button_set_popover (GTK_MENU_BUTTON (self->gear_menu_button), NULL);
       gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (self->gear_menu_button), G_MENU_MODEL (menu));
     }


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