Merge lp:~ted/indicator-appmenu/indicator-about-to-show into lp:indicator-appmenu/0.3

Proposed by Ted Gould on 2010-09-17
Status: Merged
Merged at revision: 73
Proposed branch: lp:~ted/indicator-appmenu/indicator-about-to-show
Merge into: lp:indicator-appmenu/0.3
Diff against target: 99 lines (+42/-0)
3 files modified
src/indicator-appmenu.c (+27/-0)
src/window-menus.c (+13/-0)
src/window-menus.h (+2/-0)
To merge this branch: bzr merge lp:~ted/indicator-appmenu/indicator-about-to-show
Reviewer Review Type Date Requested Status
David Barth 2010-09-17 Approve on 2010-09-21
Review via email: mp+35888@code.launchpad.net

Description of the change

Makes it so that we pass the about to show signal down into the menuitem

To post a comment you must log in.
David Barth (dbarth) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/indicator-appmenu.c'
2--- src/indicator-appmenu.c 2010-09-16 18:51:04 +0000
3+++ src/indicator-appmenu.c 2010-09-17 21:15:57 +0000
4@@ -130,6 +130,9 @@
5 static GList * get_entries (IndicatorObject * io);
6 static guint get_location (IndicatorObject * io,
7 IndicatorObjectEntry * entry);
8+static void entry_activate (IndicatorObject * io,
9+ IndicatorObjectEntry * entry,
10+ guint timestamp);
11 static void switch_default_app (IndicatorAppmenu * iapp,
12 WindowMenus * newdef,
13 BamfWindow * active_window);
14@@ -225,6 +228,7 @@
15
16 ioclass->get_entries = get_entries;
17 ioclass->get_location = get_location;
18+ ioclass->entry_activate = entry_activate;
19
20 signals[WINDOW_REGISTERED] = g_signal_new("window-registered",
21 G_TYPE_FROM_CLASS(klass),
22@@ -739,6 +743,29 @@
23 return count;
24 }
25
26+/* Responds to a menuitem being activated on the panel. */
27+static void
28+entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp)
29+{
30+ IndicatorAppmenu * iapp = INDICATOR_APPMENU(io);
31+
32+ if (iapp->default_app != NULL) {
33+ window_menus_entry_activate(iapp->default_app, entry, timestamp);
34+ return;
35+ }
36+
37+ if (iapp->active_window == NULL) {
38+ if (iapp->desktop_menu != NULL) {
39+ window_menus_entry_activate(iapp->desktop_menu, entry, timestamp);
40+ }
41+ return;
42+ }
43+
44+ /* Else we've got stubs, and the stubs don't care. */
45+
46+ return;
47+}
48+
49 /* A helper for switch_default_app that takes care of the
50 switching of the active window variable */
51 static void
52
53=== modified file 'src/window-menus.c'
54--- src/window-menus.c 2010-09-16 21:24:09 +0000
55+++ src/window-menus.c 2010-09-17 21:15:57 +0000
56@@ -52,6 +52,7 @@
57 IndicatorObjectEntry ioentry;
58 gboolean disabled;
59 gboolean hidden;
60+ DbusmenuMenuitem * mi;
61 };
62
63 #define WINDOW_MENUS_GET_PRIVATE(o) \
64@@ -573,6 +574,8 @@
65 WMEntry * wmentry = g_new0(WMEntry, 1);
66 IndicatorObjectEntry * entry = &wmentry->ioentry;
67
68+ wmentry->mi = newentry;
69+
70 entry->label = GTK_LABEL(gtk_label_new_with_mnemonic(dbusmenu_menuitem_property_get(newentry, DBUSMENU_MENUITEM_PROP_LABEL)));
71
72 if (entry->label != NULL) {
73@@ -707,3 +710,13 @@
74
75 return;
76 }
77+
78+/* Signaled when the menu item is activated on the panel so we
79+ can pass it down the stack. */
80+void
81+window_menus_entry_activate (WindowMenus * wm, IndicatorObjectEntry * entry, guint timestamp)
82+{
83+ WMEntry * wme = (WMEntry *)entry;
84+ dbusmenu_menuitem_send_about_to_show(wme->mi, NULL, NULL);
85+ return;
86+}
87
88=== modified file 'src/window-menus.h'
89--- src/window-menus.h 2010-09-14 19:13:16 +0000
90+++ src/window-menus.h 2010-09-17 21:15:57 +0000
91@@ -73,6 +73,8 @@
92 gboolean window_menus_get_error_state (WindowMenus * wm);
93 void window_menus_entry_restore (WindowMenus * wm, IndicatorObjectEntry * entry);
94
95+void window_menus_entry_activate (WindowMenus * wm, IndicatorObjectEntry * entry, guint timestamp);
96+
97 G_END_DECLS
98
99 #endif

Subscribers

People subscribed via source and target branches