Merge lp:~ted/indicator-appmenu/lp734880 into lp:indicator-appmenu/0.3

Proposed by Ted Gould
Status: Merged
Merged at revision: 110
Proposed branch: lp:~ted/indicator-appmenu/lp734880
Merge into: lp:indicator-appmenu/0.3
Diff against target: 47 lines (+34/-3)
1 file modified
src/indicator-appmenu.c (+34/-3)
To merge this branch: bzr merge lp:~ted/indicator-appmenu/lp734880
Reviewer Review Type Date Requested Status
Conor Curran (community) Approve
Review via email: mp+53565@code.launchpad.net

Description of the change

Fleshes out the unregister function so it'll actually work :-)

To post a comment you must log in.
Revision history for this message
Conor Curran (cjcurran) :
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 2011-03-09 14:14:39 +0000
3+++ src/indicator-appmenu.c 2011-03-16 04:10:25 +0000
4@@ -1305,9 +1305,40 @@
5 static GVariant *
6 unregister_window (IndicatorAppmenu * iapp, guint windowid)
7 {
8- /* TODO: Do it */
9-
10- return g_variant_new("()");
11+ g_debug("Unregistering: %d", windowid);
12+ g_return_val_if_fail(IS_INDICATOR_APPMENU(iapp), NULL);
13+ g_return_val_if_fail(iapp->matcher != NULL, NULL);
14+
15+ /* Get the application that uses that XID */
16+ BamfApplication * app = bamf_matcher_get_application_for_xid(iapp->matcher, windowid);
17+ if (app == NULL) {
18+ return NULL;
19+ }
20+ g_object_ref_sink(G_OBJECT(app));
21+
22+ /* Figure out which window is associated with it */
23+ GList * windows = bamf_application_get_windows(app);
24+ GList * lwindow;
25+ BamfWindow * window = NULL;
26+ for (lwindow = windows; lwindow != NULL; lwindow = g_list_next(lwindow)) {
27+ BamfWindow * thiswindow = BAMF_WINDOW(lwindow->data);
28+ if (bamf_window_get_xid(thiswindow) == windowid) {
29+ window = thiswindow;
30+ break;
31+ }
32+ }
33+ g_list_free(windows);
34+
35+ if (window == NULL) {
36+ g_object_unref(app);
37+ return NULL;
38+ }
39+
40+ /* Call the old_window handler for that window */
41+ old_window(iapp->matcher, BAMF_VIEW(window), iapp);
42+
43+ g_object_unref(app);
44+ return NULL;
45 }
46
47 /* Grab the menu information for a specific window */

Subscribers

People subscribed via source and target branches