ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #02970
[Branch ~indicator-applet-developers/indicator-applet/applet] Rev 379: Close the menu if menu show is called with a NULL menu
Merge authors:
Michael Terry (mterry)
Related merge proposals:
https://code.launchpad.net/~mterry/indicator-applet/close-menus-if-requested/+merge/48048
proposed by: Michael Terry (mterry)
review: Approve - Ted Gould (ted)
------------------------------------------------------------
revno: 379 [merge]
committer: Ted Gould <ted@xxxxxxxx>
branch nick: trunk
timestamp: Thu 2011-02-03 10:13:50 -0600
message:
Close the menu if menu show is called with a NULL menu
modified:
src/applet-main.c
--
lp:indicator-applet
https://code.launchpad.net/~indicator-applet-developers/indicator-applet/applet
Your team ayatana-commits is subscribed to branch lp:indicator-applet.
To unsubscribe from this branch go to https://code.launchpad.net/~indicator-applet-developers/indicator-applet/applet/+edit-subscription
=== modified file 'src/applet-main.c'
--- src/applet-main.c 2011-01-26 23:41:18 +0000
+++ src/applet-main.c 2011-01-31 20:27:31 +0000
@@ -419,6 +419,30 @@
return;
}
+static void
+menu_show (IndicatorObject * io, IndicatorObjectEntry * entry,
+ guint32 timestamp, gpointer user_data)
+{
+ GtkWidget * menubar = GTK_WIDGET(user_data);
+
+ if (entry == NULL) {
+ /* Close any open menus instead of opening one */
+ GList * entries = indicator_object_get_entries(io);
+ GList * entry = NULL;
+ for (entry = entries; entry != NULL; entry = g_list_next(entry)) {
+ IndicatorObjectEntry * entrydata = (IndicatorObjectEntry *)entry->data;
+ gtk_menu_popdown(entrydata->menu);
+ }
+ g_list_free(entries);
+
+ /* And tell the menubar to exit activation mode too */
+ gtk_menu_shell_cancel(GTK_MENU_SHELL(menubar));
+ return;
+ }
+
+ // TODO: do something sensible here
+}
+
static gboolean
load_module (const gchar * name, GtkWidget * menubar)
{
@@ -443,6 +467,7 @@
g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED, G_CALLBACK(entry_added), menubar);
g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED, G_CALLBACK(entry_removed), menubar);
g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED, G_CALLBACK(entry_moved), menubar);
+ g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_MENU_SHOW, G_CALLBACK(menu_show), menubar);
/* Work on the entries */
GList * entries = indicator_object_get_entries(io);