Merge lp:~ted/indicator-appmenu/dont-just-remove into lp:indicator-appmenu/0.3

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

Description of the change

Using the destroy() function instead of just removing from the hashtable as it handles more details of switching windows. Then we have to unref as the destroy function does not.

To post a comment you must log in.
Revision history for this message
Conor Curran (cjcurran) wrote :

I have experienced this already twice this morning.

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-02-03 16:10:19 +0000
3+++ src/indicator-appmenu.c 2011-02-07 17:17:39 +0000
4@@ -203,6 +203,8 @@
5 static void dbg_bus_get_cb (GObject * object,
6 GAsyncResult * res,
7 gpointer user_data);
8+static void menus_destroyed (GObject * menus,
9+ gpointer user_data);
10
11 /* Unique error codes for debug interface */
12 enum {
13@@ -780,12 +782,24 @@
14 BamfWindow * window = BAMF_WINDOW(view);
15 guint32 xid = bamf_window_get_xid(window);
16
17+ /* See if it's in our list of desktop windows, if
18+ so remove it from that list. */
19 if (bamf_window_get_window_type(window) == BAMF_WINDOW_DESKTOP) {
20 g_hash_table_remove(iapp->desktop_windows, GUINT_TO_POINTER(xid));
21 }
22- else {
23- g_debug("Window removed for window: %d", xid);
24- g_hash_table_remove(iapp->apps, GUINT_TO_POINTER(xid));
25+
26+ /* Now let's see if we've got a WM object for it then
27+ we need to mark it as destroyed and unreference to
28+ actually destroy it. */
29+ gpointer wm = g_hash_table_lookup(iapp->apps, GUINT_TO_POINTER(xid));
30+ if (wm != NULL) {
31+ GObject * wmo = G_OBJECT(wm);
32+
33+ /* Using destroyed so that if the menus are shown
34+ they'll be switch and the current window gets
35+ updated as well. */
36+ menus_destroyed(wmo, iapp);
37+ g_object_unref(wmo);
38 }
39
40 return;

Subscribers

People subscribed via source and target branches