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

Proposed by Ted Gould
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 Approve
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.
Revision history for this message
David Barth (dbarth) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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 @@
130static GList * get_entries (IndicatorObject * io);130static GList * get_entries (IndicatorObject * io);
131static guint get_location (IndicatorObject * io,131static guint get_location (IndicatorObject * io,
132 IndicatorObjectEntry * entry);132 IndicatorObjectEntry * entry);
133static void entry_activate (IndicatorObject * io,
134 IndicatorObjectEntry * entry,
135 guint timestamp);
133static void switch_default_app (IndicatorAppmenu * iapp,136static void switch_default_app (IndicatorAppmenu * iapp,
134 WindowMenus * newdef,137 WindowMenus * newdef,
135 BamfWindow * active_window);138 BamfWindow * active_window);
@@ -225,6 +228,7 @@
225228
226 ioclass->get_entries = get_entries;229 ioclass->get_entries = get_entries;
227 ioclass->get_location = get_location;230 ioclass->get_location = get_location;
231 ioclass->entry_activate = entry_activate;
228232
229 signals[WINDOW_REGISTERED] = g_signal_new("window-registered",233 signals[WINDOW_REGISTERED] = g_signal_new("window-registered",
230 G_TYPE_FROM_CLASS(klass),234 G_TYPE_FROM_CLASS(klass),
@@ -739,6 +743,29 @@
739 return count;743 return count;
740}744}
741745
746/* Responds to a menuitem being activated on the panel. */
747static void
748entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp)
749{
750 IndicatorAppmenu * iapp = INDICATOR_APPMENU(io);
751
752 if (iapp->default_app != NULL) {
753 window_menus_entry_activate(iapp->default_app, entry, timestamp);
754 return;
755 }
756
757 if (iapp->active_window == NULL) {
758 if (iapp->desktop_menu != NULL) {
759 window_menus_entry_activate(iapp->desktop_menu, entry, timestamp);
760 }
761 return;
762 }
763
764 /* Else we've got stubs, and the stubs don't care. */
765
766 return;
767}
768
742/* A helper for switch_default_app that takes care of the769/* A helper for switch_default_app that takes care of the
743 switching of the active window variable */770 switching of the active window variable */
744static void771static void
745772
=== 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 @@
52 IndicatorObjectEntry ioentry;52 IndicatorObjectEntry ioentry;
53 gboolean disabled;53 gboolean disabled;
54 gboolean hidden;54 gboolean hidden;
55 DbusmenuMenuitem * mi;
55};56};
5657
57#define WINDOW_MENUS_GET_PRIVATE(o) \58#define WINDOW_MENUS_GET_PRIVATE(o) \
@@ -573,6 +574,8 @@
573 WMEntry * wmentry = g_new0(WMEntry, 1);574 WMEntry * wmentry = g_new0(WMEntry, 1);
574 IndicatorObjectEntry * entry = &wmentry->ioentry;575 IndicatorObjectEntry * entry = &wmentry->ioentry;
575576
577 wmentry->mi = newentry;
578
576 entry->label = GTK_LABEL(gtk_label_new_with_mnemonic(dbusmenu_menuitem_property_get(newentry, DBUSMENU_MENUITEM_PROP_LABEL)));579 entry->label = GTK_LABEL(gtk_label_new_with_mnemonic(dbusmenu_menuitem_property_get(newentry, DBUSMENU_MENUITEM_PROP_LABEL)));
577580
578 if (entry->label != NULL) {581 if (entry->label != NULL) {
@@ -707,3 +710,13 @@
707710
708 return;711 return;
709}712}
713
714/* Signaled when the menu item is activated on the panel so we
715 can pass it down the stack. */
716void
717window_menus_entry_activate (WindowMenus * wm, IndicatorObjectEntry * entry, guint timestamp)
718{
719 WMEntry * wme = (WMEntry *)entry;
720 dbusmenu_menuitem_send_about_to_show(wme->mi, NULL, NULL);
721 return;
722}
710723
=== 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 @@
73gboolean window_menus_get_error_state (WindowMenus * wm);73gboolean window_menus_get_error_state (WindowMenus * wm);
74void window_menus_entry_restore (WindowMenus * wm, IndicatorObjectEntry * entry);74void window_menus_entry_restore (WindowMenus * wm, IndicatorObjectEntry * entry);
7575
76void window_menus_entry_activate (WindowMenus * wm, IndicatorObjectEntry * entry, guint timestamp);
77
76G_END_DECLS78G_END_DECLS
7779
78#endif80#endif

Subscribers

People subscribed via source and target branches