ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #02372
[Merge] lp:~ted/indicator-appmenu/indicator-about-to-show into lp:indicator-appmenu
Ted Gould has proposed merging lp:~ted/indicator-appmenu/indicator-about-to-show into lp:indicator-appmenu.
Requested reviews:
Indicator Applet Developers (indicator-applet-developers)
Makes it so that we pass the about to show signal down into the menuitem
--
https://code.launchpad.net/~ted/indicator-appmenu/indicator-about-to-show/+merge/35888
Your team ayatana-commits is subscribed to branch lp:indicator-appmenu.
=== modified file 'src/indicator-appmenu.c'
--- src/indicator-appmenu.c 2010-09-16 18:51:04 +0000
+++ src/indicator-appmenu.c 2010-09-17 21:15:57 +0000
@@ -130,6 +130,9 @@
static GList * get_entries (IndicatorObject * io);
static guint get_location (IndicatorObject * io,
IndicatorObjectEntry * entry);
+static void entry_activate (IndicatorObject * io,
+ IndicatorObjectEntry * entry,
+ guint timestamp);
static void switch_default_app (IndicatorAppmenu * iapp,
WindowMenus * newdef,
BamfWindow * active_window);
@@ -225,6 +228,7 @@
ioclass->get_entries = get_entries;
ioclass->get_location = get_location;
+ ioclass->entry_activate = entry_activate;
signals[WINDOW_REGISTERED] = g_signal_new("window-registered",
G_TYPE_FROM_CLASS(klass),
@@ -739,6 +743,29 @@
return count;
}
+/* Responds to a menuitem being activated on the panel. */
+static void
+entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp)
+{
+ IndicatorAppmenu * iapp = INDICATOR_APPMENU(io);
+
+ if (iapp->default_app != NULL) {
+ window_menus_entry_activate(iapp->default_app, entry, timestamp);
+ return;
+ }
+
+ if (iapp->active_window == NULL) {
+ if (iapp->desktop_menu != NULL) {
+ window_menus_entry_activate(iapp->desktop_menu, entry, timestamp);
+ }
+ return;
+ }
+
+ /* Else we've got stubs, and the stubs don't care. */
+
+ return;
+}
+
/* A helper for switch_default_app that takes care of the
switching of the active window variable */
static void
=== modified file 'src/window-menus.c'
--- src/window-menus.c 2010-09-16 21:24:09 +0000
+++ src/window-menus.c 2010-09-17 21:15:57 +0000
@@ -52,6 +52,7 @@
IndicatorObjectEntry ioentry;
gboolean disabled;
gboolean hidden;
+ DbusmenuMenuitem * mi;
};
#define WINDOW_MENUS_GET_PRIVATE(o) \
@@ -573,6 +574,8 @@
WMEntry * wmentry = g_new0(WMEntry, 1);
IndicatorObjectEntry * entry = &wmentry->ioentry;
+ wmentry->mi = newentry;
+
entry->label = GTK_LABEL(gtk_label_new_with_mnemonic(dbusmenu_menuitem_property_get(newentry, DBUSMENU_MENUITEM_PROP_LABEL)));
if (entry->label != NULL) {
@@ -707,3 +710,13 @@
return;
}
+
+/* Signaled when the menu item is activated on the panel so we
+ can pass it down the stack. */
+void
+window_menus_entry_activate (WindowMenus * wm, IndicatorObjectEntry * entry, guint timestamp)
+{
+ WMEntry * wme = (WMEntry *)entry;
+ dbusmenu_menuitem_send_about_to_show(wme->mi, NULL, NULL);
+ return;
+}
=== modified file 'src/window-menus.h'
--- src/window-menus.h 2010-09-14 19:13:16 +0000
+++ src/window-menus.h 2010-09-17 21:15:57 +0000
@@ -73,6 +73,8 @@
gboolean window_menus_get_error_state (WindowMenus * wm);
void window_menus_entry_restore (WindowMenus * wm, IndicatorObjectEntry * entry);
+void window_menus_entry_activate (WindowMenus * wm, IndicatorObjectEntry * entry, guint timestamp);
+
G_END_DECLS
#endif
Follow ups