[Xfce4-commits] [xfce/xfce4-power-manager] 01/01: Only show menu separator when there's items to separate

noreply at xfce.org noreply at xfce.org
Mon Jun 30 16:52:07 CEST 2014


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository xfce/xfce4-power-manager.

commit f5b9ed570756b95b16c9928bd384570cc7a62f64
Author: Eric Koegel <eric.koegel at gmail.com>
Date:   Mon Jun 30 17:47:47 2014 +0300

    Only show menu separator when there's items to separate
    
    In the battery plugin, there's a chance that we've filtered out
    any devices to display and thus there's no need for the menu
    separator.
---
 panel-plugins/battery/battery-button.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/panel-plugins/battery/battery-button.c b/panel-plugins/battery/battery-button.c
index ee6bdf6..0012adb 100644
--- a/panel-plugins/battery/battery-button.c
+++ b/panel-plugins/battery/battery-button.c
@@ -648,6 +648,7 @@ battery_button_show_menu (BatteryButton *button)
     GtkWidget *menu, *mi;
     GdkScreen *gscreen;
     GList *item;
+    gboolean show_separator_flag = FALSE;
 
     if(gtk_widget_has_screen(GTK_WIDGET(button)))
         gscreen = gtk_widget_get_screen(GTK_WIDGET(button));
@@ -665,12 +666,17 @@ battery_button_show_menu (BatteryButton *button)
         BatteryDevice *battery_device = item->data;
 
         battery_button_menu_add_device (button, battery_device, TRUE);
+        /* If we add an item to the menu, show the separator */
+        show_separator_flag = TRUE;
     }
 
-    /* separator */
-    mi = gtk_separator_menu_item_new();
-    gtk_widget_show(mi);
-    gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
+    if (show_separator_flag)
+    {
+        /* separator */
+        mi = gtk_separator_menu_item_new();
+        gtk_widget_show(mi);
+        gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
+    }
 
     /* Presentation mode checkbox */
     mi = gtk_check_menu_item_new_with_mnemonic (_("Presentation _mode"));

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list