Merge lp:~3v1n0/indicator-appmenu/activate-all-menus into lp:indicator-appmenu/15.10

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Christopher Townsend
Approved revision: 275
Merged at revision: 271
Proposed branch: lp:~3v1n0/indicator-appmenu/activate-all-menus
Merge into: lp:indicator-appmenu/15.10
Diff against target: 256 lines (+69/-54)
5 files modified
configure.ac (+0/-1)
src/indicator-appmenu.c (+64/-49)
src/window-menu-dbusmenu.c (+2/-2)
src/window-menu-model.c (+1/-0)
src/window-menu.c (+2/-2)
To merge this branch: bzr merge lp:~3v1n0/indicator-appmenu/activate-all-menus
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Christopher Townsend Approve
Review via email: mp+260756@code.launchpad.net

Commit message

IndicatorAppmenu: make sure we call window_menu_entry_activate also in AllMenus mode

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
275. By Marco Trevisan (Treviño)

configure.ac: remove duplicated m4 dir definition

Revision history for this message
Christopher Townsend (townsend) wrote :

Yep, works. Will top approve once Jenkins weighs in.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
276. By Marco Trevisan (Treviño)

WindowMenu: return G_MAXUINT if not found

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'configure.ac'
--- configure.ac 2015-02-03 10:07:34 +0000
+++ configure.ac 2015-06-03 23:10:32 +0000
@@ -45,7 +45,6 @@
45###########################45###########################
4646
47GTK_DOC_CHECK([1.9], [--flavour=no-tmpl])47GTK_DOC_CHECK([1.9], [--flavour=no-tmpl])
48AC_CONFIG_MACRO_DIR(m4)
4948
50###########################49###########################
51# GLib GSettings50# GLib GSettings
5251
=== modified file 'src/indicator-appmenu.c'
--- src/indicator-appmenu.c 2015-03-02 14:47:00 +0000
+++ src/indicator-appmenu.c 2015-06-03 23:10:32 +0000
@@ -181,6 +181,8 @@
181 BamfView * oldview,181 BamfView * oldview,
182 BamfView * newview,182 BamfView * newview,
183 gpointer user_data);183 gpointer user_data);
184static WindowMenu * update_active_window (IndicatorAppmenu * appmenu,
185 BamfWindow *window);
184static GQuark error_quark (void);186static GQuark error_quark (void);
185static void bus_method_call (GDBusConnection * connection,187static void bus_method_call (GDBusConnection * connection,
186 const gchar * sender,188 const gchar * sender,
@@ -750,6 +752,22 @@
750{752{
751 guint count = 0;753 guint count = 0;
752 IndicatorAppmenu * iapp = INDICATOR_APPMENU(io);754 IndicatorAppmenu * iapp = INDICATOR_APPMENU(io);
755
756 if (iapp->mode == MODE_UNITY_ALL_MENUS) {
757 GHashTableIter iter;
758 gpointer value;
759
760 g_hash_table_iter_init(&iter, iapp->apps);
761 while (g_hash_table_iter_next(&iter, NULL, &value)) {
762 count = window_menu_get_location(WINDOW_MENU (value), entry);
763
764 if (count != G_MAXUINT)
765 return count;
766 }
767
768 return 0;
769 }
770
753 if (iapp->default_app != NULL) {771 if (iapp->default_app != NULL) {
754 /* Find the location in the app */772 /* Find the location in the app */
755 count = window_menu_get_location(iapp->default_app, entry);773 count = window_menu_get_location(iapp->default_app, entry);
@@ -762,7 +780,7 @@
762 }780 }
763 if (count == iapp->window_menus->len) {781 if (count == iapp->window_menus->len) {
764 g_warning("Unable to find entry in default window menus");782 g_warning("Unable to find entry in default window menus");
765 count = 0;783 count = G_MAXUINT;
766 }784 }
767 } else {785 } else {
768 /* Find the location in the desktop menu */786 /* Find the location in the desktop menu */
@@ -770,7 +788,8 @@
770 count = window_menu_get_location(iapp->desktop_menu, entry);788 count = window_menu_get_location(iapp->desktop_menu, entry);
771 }789 }
772 }790 }
773 return count;791
792 return (count == G_MAXUINT) ? 0 : count;
774}793}
775794
776/* Responds to a menuitem being activated on the panel. */795/* Responds to a menuitem being activated on the panel. */
@@ -811,33 +830,30 @@
811static void830static void
812entry_activate_window (IndicatorObject * io, IndicatorObjectEntry * entry, guint windowid, guint timestamp)831entry_activate_window (IndicatorObject * io, IndicatorObjectEntry * entry, guint windowid, guint timestamp)
813{832{
833 WindowMenu * menus = NULL;
814 IndicatorAppmenu * iapp = INDICATOR_APPMENU(io);834 IndicatorAppmenu * iapp = INDICATOR_APPMENU(io);
815835
816 /* We need to force a focus change in this case as we probably836 /* We need to force a focus change in this case as we probably
817 just haven't gotten the signal from BAMF yet */837 just haven't gotten the signal from BAMF yet */
818 if (windowid != 0) {838 if (windowid != 0) {
819 BamfView * newwindow = BAMF_VIEW(xid_to_bamf_window(iapp, windowid));839 BamfWindow * newwindow = xid_to_bamf_window(iapp, windowid);
820840
821 if (newwindow != NULL) {841 if (newwindow != NULL) {
822 active_window_changed(iapp->matcher, BAMF_VIEW(iapp->active_window), newwindow, iapp);842 menus = update_active_window(iapp, newwindow);
823 }843 }
824 }844 }
825845
826 if (iapp->default_app != NULL) {846 if (iapp->mode != MODE_UNITY_ALL_MENUS && iapp->default_app != NULL) {
827 window_menu_entry_activate(iapp->default_app, entry, timestamp);847 menus = iapp->default_app;
828 return;848
829 }849 if (!menus && iapp->active_window == NULL) {
830850 menus = iapp->desktop_menu;
831 if (iapp->active_window == NULL) {851 }
832 if (iapp->desktop_menu != NULL) {852 }
833 window_menu_entry_activate(iapp->desktop_menu, entry, timestamp);853
834 }854 if (menus) {
835 return;855 window_menu_entry_activate(menus, entry, timestamp);
836 }856 }
837
838 /* Else we've got stubs, and the stubs don't care. */
839
840 return;
841}857}
842858
843/* Checks to see we cared about a window that's going859/* Checks to see we cared about a window that's going
@@ -858,7 +874,7 @@
858874
859 /* We're going to a state where we don't know what the active875 /* We're going to a state where we don't know what the active
860 window is, hopefully BAMF will save us */876 window is, hopefully BAMF will save us */
861 active_window_changed (iapp->matcher, NULL, NULL, iapp);877 active_window_changed(iapp->matcher, NULL, NULL, iapp);
862878
863 return;879 return;
864}880}
@@ -1072,41 +1088,41 @@
1072static void1088static void
1073active_window_changed (BamfMatcher * matcher, BamfView * oldview, BamfView * newview, gpointer user_data)1089active_window_changed (BamfMatcher * matcher, BamfView * oldview, BamfView * newview, gpointer user_data)
1074{1090{
1075 BamfWindow * window = NULL;1091 update_active_window(INDICATOR_APPMENU(user_data), (BamfWindow *) newview);
10761092}
1077 if (newview != NULL) {1093
1078 window = BAMF_WINDOW(newview);1094static WindowMenu *
1079 if (window == NULL) {1095update_active_window (IndicatorAppmenu * appmenu, BamfWindow *window)
1096{
1097 WindowMenu * menus = NULL;
1098
1099 if (window != NULL) {
1100 if (!BAMF_IS_WINDOW(window)) {
1101 window = NULL;
1080 g_warning("Active window changed to View thats not a window.");1102 g_warning("Active window changed to View thats not a window.");
1081 }1103 }
1082 } else {1104 } else {
1083 g_debug("Active window is: NULL");1105 g_debug("Active window is: NULL");
1084 }1106 }
10851107
1086 IndicatorAppmenu * appmenu = INDICATOR_APPMENU(user_data);1108 if (appmenu->mode == MODE_UNITY_ALL_MENUS) {
10871109 if (window != NULL) {
1088 if (window != NULL && appmenu->mode == MODE_UNITY_ALL_MENUS) {1110 menus = ensure_menus(appmenu, window);
1089 ensure_menus(appmenu, window);1111 }
1090 return;1112 return menus;
1091 }1113 }
10921114
1093 if (window != NULL && bamf_window_get_window_type(window) == BAMF_WINDOW_DESKTOP) {1115 if (window != NULL && bamf_window_get_window_type(window) == BAMF_WINDOW_DESKTOP) {
1094 g_debug("Switching to menus from desktop");1116 g_debug("Switching to menus from desktop");
1095 switch_default_app(appmenu, NULL, NULL);1117 switch_default_app(appmenu, NULL, NULL);
1096 return;1118 return menus;
1097 }1119 }
10981120
1099 WindowMenu * menus = ensure_menus (appmenu, window);1121 g_debug("Switching to menus from XID %d", window ? bamf_window_get_xid(window) : 0);
11001122 menus = ensure_menus(appmenu, window);
1101 /* Note: We're not using window here, but re-casting the1123 switch_default_app(appmenu, menus, window);
1102 newwindow variable. Which means we stay where we were1124
1103 but get the menus from parents. */1125 return menus;
1104 g_debug("Switching to menus from XID %d", newview ? bamf_window_get_xid(BAMF_WINDOW(newview)) : 0);
1105 if (newview != NULL) {
1106 switch_default_app(appmenu, menus, BAMF_WINDOW(newview));
1107 } else {
1108 switch_default_app(appmenu, menus, NULL);
1109 }
1110}1126}
11111127
1112/* Respond to the menus being destroyed. We need to deregister1128/* Respond to the menus being destroyed. We need to deregister
@@ -1176,8 +1192,7 @@
11761192
1177 /* Note: Does not cause ref */1193 /* Note: Does not cause ref */
1178 BamfWindow * win = bamf_matcher_get_active_window(iapp->matcher);1194 BamfWindow * win = bamf_matcher_get_active_window(iapp->matcher);
11791195 update_active_window(iapp, win);
1180 active_window_changed(iapp->matcher, NULL, BAMF_VIEW(win), iapp);
1181 } else {1196 } else {
1182 if (windowid == 0) {1197 if (windowid == 0) {
1183 g_warning("Can't build windows for a NULL window ID %d with path %s from %s", windowid, objectpath, sender);1198 g_warning("Can't build windows for a NULL window ID %d with path %s from %s", windowid, objectpath, sender);
11841199
=== modified file 'src/window-menu-dbusmenu.c'
--- src/window-menu-dbusmenu.c 2015-01-29 14:46:43 +0000
+++ src/window-menu-dbusmenu.c 2015-06-03 23:10:32 +0000
@@ -455,7 +455,7 @@
455 g_return_val_if_fail(IS_WINDOW_MENU_DBUSMENU(wm), 0);455 g_return_val_if_fail(IS_WINDOW_MENU_DBUSMENU(wm), 0);
456456
457 if (entry == NULL) {457 if (entry == NULL) {
458 return 0;458 return G_MAXUINT;
459 }459 }
460460
461 guint i;461 guint i;
@@ -467,7 +467,7 @@
467 }467 }
468468
469 if (i == priv->entries->len) {469 if (i == priv->entries->len) {
470 return 0;470 return G_MAXUINT;
471 }471 }
472472
473 return i;473 return i;
474474
=== modified file 'src/window-menu-model.c'
--- src/window-menu-model.c 2015-03-02 14:37:03 +0000
+++ src/window-menu-model.c 2015-06-03 23:10:32 +0000
@@ -602,6 +602,7 @@
602 /* NOTE: Not printing any of the values here because there's602 /* NOTE: Not printing any of the values here because there's
603 a pretty good chance that they're not valid. Let's not crash603 a pretty good chance that they're not valid. Let's not crash
604 things here. */604 things here. */
605 pos = G_MAXUINT;
605 g_warning("Unable to find entry: %p", entry);606 g_warning("Unable to find entry: %p", entry);
606 }607 }
607608
608609
=== modified file 'src/window-menu.c'
--- src/window-menu.c 2014-03-19 13:07:30 +0000
+++ src/window-menu.c 2015-06-03 23:10:32 +0000
@@ -150,14 +150,14 @@
150guint150guint
151window_menu_get_location (WindowMenu * wm, IndicatorObjectEntry * entry)151window_menu_get_location (WindowMenu * wm, IndicatorObjectEntry * entry)
152{152{
153 g_return_val_if_fail (IS_WINDOW_MENU(wm), 0);153 g_return_val_if_fail (IS_WINDOW_MENU(wm), G_MAXUINT);
154154
155 WindowMenuClass * class = WINDOW_MENU_GET_CLASS(wm);155 WindowMenuClass * class = WINDOW_MENU_GET_CLASS(wm);
156156
157 if (class->get_location != NULL) {157 if (class->get_location != NULL) {
158 return class->get_location(wm, entry);158 return class->get_location(wm, entry);
159 } else {159 } else {
160 return 0;160 return G_MAXUINT;
161 }161 }
162}162}
163163

Subscribers

People subscribed via source and target branches