[Xfce4-commits] <xfce4-panel:master> Recurse application menu selection-done signal (bug #8541).

Nick Schermer noreply at xfce.org
Sat Mar 10 20:22:01 CET 2012


Updating branch refs/heads/master
         to be76d74bf68d66880a302c68dcea301e0a72b8ea (commit)
       from 56b2c90a9df572f968fb5a50b6337cc5a6f4a62c (commit)

commit be76d74bf68d66880a302c68dcea301e0a72b8ea
Author: Nick Schermer <nick at xfce.org>
Date:   Sat Mar 10 20:20:23 2012 +0100

    Recurse application menu selection-done signal (bug #8541).
    
    selection-done is not send to the parent menu, do add this
    signal to all submenus as well.

 plugins/applicationsmenu/applicationsmenu.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/plugins/applicationsmenu/applicationsmenu.c b/plugins/applicationsmenu/applicationsmenu.c
index 4e208b2..e3209f8 100644
--- a/plugins/applicationsmenu/applicationsmenu.c
+++ b/plugins/applicationsmenu/applicationsmenu.c
@@ -888,6 +888,7 @@ applications_menu_plugin_menu_reload (ApplicationsMenuPlugin *plugin)
 
 static gboolean
 applications_menu_plugin_menu_add (GtkWidget              *gtk_menu,
+                                   GtkWidget              *button,
                                    GarconMenu             *menu,
                                    ApplicationsMenuPlugin *plugin)
 {
@@ -904,6 +905,7 @@ applications_menu_plugin_menu_add (GtkWidget              *gtk_menu,
   panel_return_val_if_fail (GTK_IS_MENU (gtk_menu), FALSE);
   panel_return_val_if_fail (GARCON_IS_MENU (menu), FALSE);
   panel_return_val_if_fail (XFCE_IS_APPLICATIONS_MENU_PLUGIN (plugin), FALSE);
+  panel_return_val_if_fail (button == NULL || GTK_IS_TOGGLE_BUTTON (button), FALSE);
 
   if (gtk_icon_size_lookup (menu_icon_size, &w, &h))
     size = MIN (w, h);
@@ -987,12 +989,14 @@ applications_menu_plugin_menu_add (GtkWidget              *gtk_menu,
             continue;
 
           submenu = gtk_menu_new ();
-          if (applications_menu_plugin_menu_add (submenu, li->data, plugin))
+          if (applications_menu_plugin_menu_add (submenu, button, li->data, plugin))
             {
               name = garcon_menu_element_get_name (li->data);
               mi = gtk_image_menu_item_new_with_label (name);
               gtk_menu_shell_append (GTK_MENU_SHELL (gtk_menu), mi);
               gtk_menu_item_set_submenu (GTK_MENU_ITEM (mi), submenu);
+              g_signal_connect (G_OBJECT (submenu), "selection-done",
+                  G_CALLBACK (applications_menu_plugin_menu_deactivate), button);
               gtk_widget_show (mi);
 
               g_signal_connect_swapped (G_OBJECT (li->data), "directory-changed",
@@ -1068,7 +1072,7 @@ applications_menu_plugin_menu (GtkWidget              *button,
                G_CALLBACK (applications_menu_plugin_menu_deactivate), button);
           g_object_add_weak_pointer (G_OBJECT (plugin->menu), (gpointer) &plugin->menu);
 
-          if (!applications_menu_plugin_menu_add (plugin->menu, menu, plugin))
+          if (!applications_menu_plugin_menu_add (plugin->menu, button, menu, plugin))
             {
               mi = gtk_menu_item_new_with_label (_("No applications found"));
               gtk_menu_shell_append (GTK_MENU_SHELL (plugin->menu), mi);


More information about the Xfce4-commits mailing list