Merge lp:~unity-team/unity/fix-panel-service-finalize into lp:unity

Proposed by Neil J. Patel
Status: Merged
Approved by: Gord Allott
Approved revision: no longer in the source branch.
Merged at revision: 638
Proposed branch: lp:~unity-team/unity/fix-panel-service-finalize
Merge into: lp:unity
Diff against target: 116 lines (+35/-11)
2 files modified
services/CMakeLists.txt (+1/-0)
services/panel-service.c (+34/-11)
To merge this branch: bzr merge lp:~unity-team/unity/fix-panel-service-finalize
Reviewer Review Type Date Requested Status
Gord Allott (community) Approve
Review via email: mp+42124@code.launchpad.net

Description of the change

From London, with love.

To post a comment you must log in.
Revision history for this message
Gord Allott (gordallott) wrote :

Whoop, approved. if you can, try and get david to test this too though, he was having the problems ;)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'services/CMakeLists.txt'
2--- services/CMakeLists.txt 2010-11-12 10:20:04 +0000
3+++ services/CMakeLists.txt 2010-11-29 17:44:14 +0000
4@@ -13,6 +13,7 @@
5 "-DGETTEXT_PACKAGE=\"unity\""
6 "-DINDICATORDIR=\"${_indicatordir}\""
7 "-DINDICATORICONDIR=\"${_iconsdir}\""
8+ "-Werror -Wall"
9 )
10 add_definitions(${CFLAGS})
11
12
13=== modified file 'services/panel-service.c'
14--- services/panel-service.c 2010-11-25 17:30:40 +0000
15+++ services/panel-service.c 2010-11-29 17:44:14 +0000
16@@ -33,6 +33,9 @@
17 (G_TYPE_INSTANCE_GET_PRIVATE ((o), PANEL_TYPE_SERVICE, PanelServicePrivate))
18
19 #define NOTIFY_TIMEOUT 80
20+#define N_TIMEOUT_SLOTS 50
21+
22+static PanelService *static_service = NULL;
23
24 struct _PanelServicePrivate
25 {
26@@ -40,7 +43,8 @@
27 GHashTable *id2entry_hash;
28 GHashTable *entry2indicator_hash;
29
30- gint32 timeouts[100];
31+ guint initial_sync_id;
32+ gint32 timeouts[N_TIMEOUT_SLOTS];
33
34 GtkMenu *last_menu;
35 guint32 last_menu_id;
36@@ -98,16 +102,33 @@
37 /*
38 * GObject stuff
39 */
40+
41 static void
42 panel_service_class_dispose (GObject *object)
43 {
44 PanelServicePrivate *priv = PANEL_SERVICE (object)->priv;
45+ gint i;
46
47 g_hash_table_destroy (priv->id2entry_hash);
48 g_hash_table_destroy (priv->entry2indicator_hash);
49
50 gdk_window_remove_filter (NULL, (GdkFilterFunc)event_filter, object);
51
52+ if (priv->initial_sync_id)
53+ {
54+ g_source_remove (priv->initial_sync_id);
55+ priv->initial_sync_id = 0;
56+ }
57+
58+ for (i = 0; i < N_TIMEOUT_SLOTS; i++)
59+ {
60+ if (priv->timeouts[i] > 0)
61+ {
62+ g_source_remove (priv->timeouts[i]);
63+ priv->timeouts[i] = 0;
64+ }
65+ }
66+
67 G_OBJECT_CLASS (panel_service_parent_class)->dispose (object);
68 }
69
70@@ -246,9 +267,10 @@
71 initial_resync (PanelService *self)
72 {
73 if (PANEL_IS_SERVICE (self))
74- g_signal_emit (self, _service_signals[RE_SYNC], 0, "");
75-
76-
77+ {
78+ g_signal_emit (self, _service_signals[RE_SYNC], 0, "");
79+ self->priv->initial_sync_id = 0;
80+ }
81 return FALSE;
82 }
83
84@@ -269,18 +291,16 @@
85 sort_indicators (self);
86 suppress_signals = FALSE;
87
88- g_idle_add ((GSourceFunc)initial_resync, self);
89+ priv->initial_sync_id = g_idle_add ((GSourceFunc)initial_resync, self);
90 }
91
92 PanelService *
93 panel_service_get_default ()
94 {
95- static PanelService *service = NULL;
96-
97- if (service == NULL || !PANEL_IS_SERVICE (service))
98- service = g_object_new (PANEL_TYPE_SERVICE, NULL);
99-
100- return service;
101+ if (static_service == NULL || !PANEL_IS_SERVICE (static_service))
102+ static_service = g_object_new (PANEL_TYPE_SERVICE, NULL);
103+
104+ return static_service;
105 }
106
107 PanelService *
108@@ -316,6 +336,9 @@
109 PanelServicePrivate *priv;
110 gint position;
111
112+ if (!PANEL_IS_SERVICE (static_service))
113+ return FALSE;
114+
115 if (!INDICATOR_IS_OBJECT (object))
116 return FALSE;
117