Merge lp:~c10ud/indicator-application/runtime-themepath-change into lp:indicator-application/0.4
- runtime-themepath-change
- Merge into trunk
Proposed by
Sense Egbert Hofstede
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 143 | ||||
Proposed branch: | lp:~c10ud/indicator-application/runtime-themepath-change | ||||
Merge into: | lp:indicator-application/0.4 | ||||
Diff against target: |
743 lines (+258/-49) 9 files modified
bindings/mono/libappindicator-api.metadata (+5/-1) bindings/python/appindicator.defs (+16/-1) src/app-indicator.c (+72/-16) src/app-indicator.h (+14/-1) src/application-service-appstore.c (+80/-13) src/application-service-appstore.h (+2/-1) src/application-service.xml (+4/-0) src/indicator-application.c (+63/-16) src/notification-item.xml (+2/-0) |
||||
To merge this branch: | bzr merge lp:~c10ud/indicator-application/runtime-themepath-change | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Indicator Applet Developers | Pending | ||
Review via email: mp+30695@code.launchpad.net |
Commit message
Description of the change
It works now and was tested by C10uD.
To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'bindings/mono/libappindicator-api.metadata' |
2 | --- bindings/mono/libappindicator-api.metadata 2010-05-23 10:44:53 +0000 |
3 | +++ bindings/mono/libappindicator-api.metadata 2010-07-22 17:41:15 +0000 |
4 | @@ -9,6 +9,8 @@ |
5 | <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='connection_changed']" name="cname">connection-changed</attr> |
6 | <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_icon']" name="name">NewIcon</attr> |
7 | <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_icon']" name="cname">new-icon</attr> |
8 | + <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_icon_theme_path']" name="name">NewIconThemePath</attr> |
9 | + <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_icon_theme_path']" name="cname">new-icon-theme-path</attr> |
10 | <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_ID_S']" name="name">ID</attr> |
11 | <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_CATEGORY_S']" name="hidden">true</attr> |
12 | <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_STATUS_S']" name="hidden">true</attr> |
13 | @@ -26,16 +28,18 @@ |
14 | <attr path="/api/namespace/object[@cname='AppIndicator']/constructor[@cname='app_indicator_new_with_path']/*/*[@name='id']" name="property_name">id</attr> |
15 | <attr path="/api/namespace/object[@cname='AppIndicator']/constructor[@cname='app_indicator_new_with_path']/*/*[@name='icon_name']" name="property_name">icon-name</attr> |
16 | <attr path="/api/namespace/object[@cname='AppIndicator']/constructor[@cname='app_indicator_new_with_path']/*/*[@name='category']" name="property_name">category</attr> |
17 | - <attr path="/api/namespace/object[@cname='AppIndicator']/constructor[@cname='app_indicator_new_with_path']/*/*[@name='icon_path']" name="property_name">icon-theme-path</attr> |
18 | + <attr path="/api/namespace/object[@cname='AppIndicator']/constructor[@cname='app_indicator_new_with_path']/*/*[@name='icon_theme_path']" name="property_name">icon-theme-path</attr> |
19 | |
20 | <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_id']" /> |
21 | <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_status']" /> |
22 | <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_icon']" /> |
23 | + <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_icon_theme_path']" /> |
24 | <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_category']" /> |
25 | <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_attention_icon']" /> |
26 | |
27 | <remove-node path="/api/namespace/object/method[@cname='app_indicator_set_id']" /> |
28 | <remove-node path="/api/namespace/object/method[@cname='app_indicator_set_status']" /> |
29 | <remove-node path="/api/namespace/object/method[@cname='app_indicator_set_icon']" /> |
30 | + <remove-node path="/api/namespace/object/method[@cname='app_indicator_set_icon_theme_path']" /> |
31 | <remove-node path="/api/namespace/object/method[@cname='app_indicator_set_attention_icon']" /> |
32 | </metadata> |
33 | |
34 | === modified file 'bindings/python/appindicator.defs' |
35 | --- bindings/python/appindicator.defs 2010-03-30 19:09:04 +0000 |
36 | +++ bindings/python/appindicator.defs 2010-07-22 17:41:15 +0000 |
37 | @@ -49,7 +49,7 @@ |
38 | '("const-gchar*" "id") |
39 | '("const-gchar*" "icon_name") |
40 | '("AppIndicatorCategory" "category") |
41 | - '("const-gchar*" "icon_path" (null-ok) (default "NULL")) |
42 | + '("const-gchar*" "icon_theme_path" (null-ok) (default "NULL")) |
43 | ) |
44 | ) |
45 | |
46 | @@ -89,6 +89,15 @@ |
47 | ) |
48 | ) |
49 | |
50 | +(define-method set_icon_theme_path |
51 | + (of-object "AppIndicator") |
52 | + (c-name "app_indicator_set_icon_theme_path") |
53 | + (return-type "none") |
54 | + (parameters |
55 | + '("const-gchar*" "icon_theme_path" (null-ok)) |
56 | + ) |
57 | +) |
58 | + |
59 | (define-method get_id |
60 | (of-object "AppIndicator") |
61 | (c-name "app_indicator_get_id") |
62 | @@ -113,6 +122,12 @@ |
63 | (return-type "const-gchar*") |
64 | ) |
65 | |
66 | +(define-method get_icon_theme_path |
67 | + (of-object "AppIndicator") |
68 | + (c-name "app_indicator_get_icon_theme_path") |
69 | + (return-type "const-gchar*") |
70 | +) |
71 | + |
72 | (define-method get_attention_icon |
73 | (of-object "AppIndicator") |
74 | (c-name "app_indicator_get_attention_icon") |
75 | |
76 | === modified file 'src/app-indicator.c' |
77 | --- src/app-indicator.c 2010-07-07 19:17:31 +0000 |
78 | +++ src/app-indicator.c 2010-07-22 17:41:15 +0000 |
79 | @@ -69,7 +69,7 @@ |
80 | AppIndicatorStatus status; |
81 | gchar *icon_name; |
82 | gchar *attention_icon_name; |
83 | - gchar * icon_path; |
84 | + gchar *icon_theme_path; |
85 | DbusmenuServer *menuservice; |
86 | GtkWidget *menu; |
87 | |
88 | @@ -88,6 +88,7 @@ |
89 | NEW_ATTENTION_ICON, |
90 | NEW_STATUS, |
91 | CONNECTION_CHANGED, |
92 | + NEW_ICON_THEME_PATH, |
93 | LAST_SIGNAL |
94 | }; |
95 | |
96 | @@ -229,7 +230,7 @@ |
97 | "An icon for the indicator", |
98 | "The default icon that is shown for the indicator.", |
99 | NULL, |
100 | - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
101 | + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT)); |
102 | |
103 | /** |
104 | AppIndicator:attention-icon-name: |
105 | @@ -256,7 +257,7 @@ |
106 | "An additional path for custom icons.", |
107 | "An additional place to look for icon names that may be installed by the application.", |
108 | NULL, |
109 | - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY)); |
110 | + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT)); |
111 | |
112 | /** |
113 | AppIndicator:menu: |
114 | @@ -347,6 +348,21 @@ |
115 | g_cclosure_marshal_VOID__BOOLEAN, |
116 | G_TYPE_NONE, 1, G_TYPE_BOOLEAN, G_TYPE_NONE); |
117 | |
118 | + /** |
119 | + AppIndicator::new-icon-theme-path: |
120 | + @arg0: The #AppIndicator object |
121 | + |
122 | + Signaled when there is a new icon set for the |
123 | + object. |
124 | + */ |
125 | + signals[NEW_ICON_THEME_PATH] = g_signal_new (APP_INDICATOR_SIGNAL_NEW_ICON_THEME_PATH, |
126 | + G_TYPE_FROM_CLASS(klass), |
127 | + G_SIGNAL_RUN_LAST, |
128 | + G_STRUCT_OFFSET (AppIndicatorClass, new_icon_theme_path), |
129 | + NULL, NULL, |
130 | + g_cclosure_marshal_VOID__VOID, |
131 | + G_TYPE_NONE, 0, G_TYPE_NONE); |
132 | + |
133 | /* Initialize the object as a DBus type */ |
134 | dbus_g_object_type_install_info(APP_INDICATOR_TYPE, |
135 | &dbus_glib__notification_item_server_object_info); |
136 | @@ -365,7 +381,7 @@ |
137 | priv->status = APP_INDICATOR_STATUS_PASSIVE; |
138 | priv->icon_name = NULL; |
139 | priv->attention_icon_name = NULL; |
140 | - priv->icon_path = NULL; |
141 | + priv->icon_theme_path = NULL; |
142 | priv->menu = NULL; |
143 | priv->menuservice = NULL; |
144 | |
145 | @@ -487,9 +503,9 @@ |
146 | priv->attention_icon_name = NULL; |
147 | } |
148 | |
149 | - if (priv->icon_path != NULL) { |
150 | - g_free(priv->icon_path); |
151 | - priv->icon_path = NULL; |
152 | + if (priv->icon_theme_path != NULL) { |
153 | + g_free(priv->icon_theme_path); |
154 | + priv->icon_theme_path = NULL; |
155 | } |
156 | |
157 | G_OBJECT_CLASS (app_indicator_parent_class)->finalize (object); |
158 | @@ -557,10 +573,9 @@ |
159 | break; |
160 | |
161 | case PROP_ICON_THEME_PATH: |
162 | - if (priv->icon_path != NULL) { |
163 | - g_free(priv->icon_path); |
164 | - } |
165 | - priv->icon_path = g_value_dup_string(value); |
166 | + app_indicator_set_icon_theme_path (APP_INDICATOR (object), |
167 | + g_value_get_string (value)); |
168 | + check_connect (self); |
169 | break; |
170 | |
171 | default: |
172 | @@ -603,7 +618,7 @@ |
173 | break; |
174 | |
175 | case PROP_ICON_THEME_PATH: |
176 | - g_value_set_string (value, priv->icon_path); |
177 | + g_value_set_string (value, priv->icon_theme_path); |
178 | break; |
179 | |
180 | case PROP_MENU: |
181 | @@ -1025,12 +1040,12 @@ |
182 | @id: The unique id of the indicator to create. |
183 | @icon_name: The icon name for this indicator |
184 | @category: The category of indicator. |
185 | - @icon_path: A custom path for finding icons. |
186 | + @icon_theme_path: A custom path for finding icons. |
187 | |
188 | Creates a new #AppIndicator setting the properties: |
189 | #AppIndicator:id with @id, #AppIndicator:category |
190 | with @category, #AppIndicator:icon-name with |
191 | - @icon_name and #AppIndicator:icon-theme-path with @icon_path. |
192 | + @icon_name and #AppIndicator:icon-theme-path with @icon_theme_path. |
193 | |
194 | Return value: A pointer to a new #AppIndicator object. |
195 | */ |
196 | @@ -1038,13 +1053,13 @@ |
197 | app_indicator_new_with_path (const gchar *id, |
198 | const gchar *icon_name, |
199 | AppIndicatorCategory category, |
200 | - const gchar *icon_path) |
201 | + const gchar *icon_theme_path) |
202 | { |
203 | AppIndicator *indicator = g_object_new (APP_INDICATOR_TYPE, |
204 | PROP_ID_S, id, |
205 | PROP_CATEGORY_S, category_from_enum (category), |
206 | PROP_ICON_NAME_S, icon_name, |
207 | - PROP_ICON_THEME_PATH_S, icon_path, |
208 | + PROP_ICON_THEME_PATH_S, icon_theme_path, |
209 | NULL); |
210 | |
211 | return indicator; |
212 | @@ -1134,6 +1149,31 @@ |
213 | return; |
214 | } |
215 | |
216 | +/** |
217 | + app_indicator_set_icon_theme_path: |
218 | + @self: The #AppIndicator object to use |
219 | + @icon_theme_path: The icon theme path to set. |
220 | + |
221 | + Sets the path to use when searching for icons. |
222 | +**/ |
223 | +void |
224 | +app_indicator_set_icon_theme_path (AppIndicator *self, const gchar *icon_theme_path) |
225 | +{ |
226 | + g_return_if_fail (IS_APP_INDICATOR (self)); |
227 | + |
228 | + if (g_strcmp0 (self->priv->icon_theme_path, icon_theme_path) != 0) |
229 | + { |
230 | + if (self->priv->icon_theme_path != NULL) |
231 | + g_free(self->priv->icon_theme_path); |
232 | + |
233 | + self->priv->icon_theme_path = g_strdup(icon_theme_path); |
234 | + |
235 | + g_signal_emit (self, signals[NEW_ICON_THEME_PATH], 0, TRUE); |
236 | + } |
237 | + |
238 | + return; |
239 | +} |
240 | + |
241 | static void |
242 | activate_menuitem (DbusmenuMenuitem *mi, guint timestamp, gpointer user_data) |
243 | { |
244 | @@ -1626,6 +1666,22 @@ |
245 | } |
246 | |
247 | /** |
248 | + app_indicator_get_icon_theme_path: |
249 | + @self: The #AppIndicator object to use |
250 | + |
251 | + Wrapper function for property #AppIndicator:icon-theme-path. |
252 | + |
253 | + Return value: The current icon theme path. |
254 | +*/ |
255 | +const gchar * |
256 | +app_indicator_get_icon_theme_path (AppIndicator *self) |
257 | +{ |
258 | + g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); |
259 | + |
260 | + return self->priv->icon_theme_path; |
261 | +} |
262 | + |
263 | +/** |
264 | app_indicator_get_attention_icon: |
265 | @self: The #AppIndicator object to use |
266 | |
267 | |
268 | === modified file 'src/app-indicator.h' |
269 | --- src/app-indicator.h 2010-05-23 10:44:53 +0000 |
270 | +++ src/app-indicator.h 2010-07-22 17:41:15 +0000 |
271 | @@ -69,6 +69,7 @@ |
272 | |
273 | Gets a pointer to the #AppIndicatorClass for the object @obj. |
274 | */ |
275 | + |
276 | #define APP_INDICATOR_TYPE (app_indicator_get_type ()) |
277 | #define APP_INDICATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APP_INDICATOR_TYPE, AppIndicator)) |
278 | #define APP_INDICATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), APP_INDICATOR_TYPE, AppIndicatorClass)) |
279 | @@ -96,10 +97,16 @@ |
280 | |
281 | String identifier for the #AppIndicator::connection-changed signal. |
282 | */ |
283 | +/** |
284 | + APP_INDICATOR_SIGNAL_NEW_ICON_THEME_PATH: |
285 | + |
286 | + String identifier for the #AppIndicator::new-icon-theme-path signal. |
287 | +*/ |
288 | #define APP_INDICATOR_SIGNAL_NEW_ICON "new-icon" |
289 | #define APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON "new-attention-icon" |
290 | #define APP_INDICATOR_SIGNAL_NEW_STATUS "new-status" |
291 | #define APP_INDICATOR_SIGNAL_CONNECTION_CHANGED "connection-changed" |
292 | +#define APP_INDICATOR_SIGNAL_NEW_ICON_THEME_PATH "new-icon-theme-path" |
293 | |
294 | /** |
295 | AppIndicatorCategory: |
296 | @@ -147,6 +154,7 @@ |
297 | @new_icon: Slot for #AppIndicator::new-icon. |
298 | @new_attention_icon: Slot for #AppIndicator::new-attention-icon. |
299 | @new_status: Slot for #AppIndicator::new-status. |
300 | + @new_icon_theme_path: Slot for #AppIndicator::new-icon-theme-path |
301 | @connection_changed: Slot for #AppIndicator::connection-changed. |
302 | @fallback: Function that gets called to make a #GtkStatusIcon when |
303 | there is no Application Indicator area available. |
304 | @@ -170,6 +178,8 @@ |
305 | void (* new_status) (AppIndicator *indicator, |
306 | const gchar *status, |
307 | gpointer user_data); |
308 | + void (* new_icon_theme_path) (AppIndicator *indicator, |
309 | + gpointer user_data); |
310 | |
311 | /* Local Signals */ |
312 | void (* connection_changed) (AppIndicator * indicator, |
313 | @@ -215,7 +225,7 @@ |
314 | AppIndicator *app_indicator_new_with_path (const gchar *id, |
315 | const gchar *icon_name, |
316 | AppIndicatorCategory category, |
317 | - const gchar *icon_path); |
318 | + const gchar *icon_theme_path); |
319 | |
320 | /* Set properties */ |
321 | void app_indicator_set_status (AppIndicator *self, |
322 | @@ -226,12 +236,15 @@ |
323 | GtkMenu *menu); |
324 | void app_indicator_set_icon (AppIndicator *self, |
325 | const gchar *icon_name); |
326 | +void app_indicator_set_icon_theme_path(AppIndicator *self, |
327 | + const gchar *icon_theme_path); |
328 | |
329 | /* Get properties */ |
330 | const gchar * app_indicator_get_id (AppIndicator *self); |
331 | AppIndicatorCategory app_indicator_get_category (AppIndicator *self); |
332 | AppIndicatorStatus app_indicator_get_status (AppIndicator *self); |
333 | const gchar * app_indicator_get_icon (AppIndicator *self); |
334 | +const gchar * app_indicator_get_icon_theme_path(AppIndicator *self); |
335 | const gchar * app_indicator_get_attention_icon (AppIndicator *self); |
336 | GtkMenu * app_indicator_get_menu (AppIndicator *self); |
337 | |
338 | |
339 | === modified file 'src/application-service-appstore.c' |
340 | --- src/application-service-appstore.c 2010-07-09 21:29:22 +0000 |
341 | +++ src/application-service-appstore.c 2010-07-22 17:41:15 +0000 |
342 | @@ -43,12 +43,13 @@ |
343 | #define NOTIFICATION_ITEM_PROP_STATUS "Status" |
344 | #define NOTIFICATION_ITEM_PROP_ICON_NAME "IconName" |
345 | #define NOTIFICATION_ITEM_PROP_AICON_NAME "AttentionIconName" |
346 | -#define NOTIFICATION_ITEM_PROP_ICON_PATH "IconThemePath" |
347 | +#define NOTIFICATION_ITEM_PROP_ICON_THEME_PATH "IconThemePath" |
348 | #define NOTIFICATION_ITEM_PROP_MENU "Menu" |
349 | |
350 | #define NOTIFICATION_ITEM_SIG_NEW_ICON "NewIcon" |
351 | #define NOTIFICATION_ITEM_SIG_NEW_AICON "NewAttentionIcon" |
352 | #define NOTIFICATION_ITEM_SIG_NEW_STATUS "NewStatus" |
353 | +#define NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH "NewIconThemePath" |
354 | |
355 | /* Private Stuff */ |
356 | struct _ApplicationServiceAppstorePrivate { |
357 | @@ -77,7 +78,7 @@ |
358 | gchar * icon; |
359 | gchar * aicon; |
360 | gchar * menu; |
361 | - gchar * icon_path; |
362 | + gchar * icon_theme_path; |
363 | gboolean currently_free; |
364 | }; |
365 | |
366 | @@ -89,6 +90,7 @@ |
367 | APPLICATION_ADDED, |
368 | APPLICATION_REMOVED, |
369 | APPLICATION_ICON_CHANGED, |
370 | + APPLICATION_ICON_THEME_PATH_CHANGED, |
371 | LAST_SIGNAL |
372 | }; |
373 | |
374 | @@ -138,6 +140,13 @@ |
375 | NULL, NULL, |
376 | _application_service_marshal_VOID__INT_STRING, |
377 | G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_STRING, G_TYPE_NONE); |
378 | + signals[APPLICATION_ICON_THEME_PATH_CHANGED] = g_signal_new ("application-icon-theme-path-changed", |
379 | + G_TYPE_FROM_CLASS(klass), |
380 | + G_SIGNAL_RUN_LAST, |
381 | + G_STRUCT_OFFSET (ApplicationServiceAppstoreClass, application_icon_theme_path_changed), |
382 | + NULL, NULL, |
383 | + _application_service_marshal_VOID__INT_STRING, |
384 | + G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_STRING, G_TYPE_NONE); |
385 | |
386 | dbus_g_object_type_install_info(APPLICATION_SERVICE_APPSTORE_TYPE, |
387 | &dbus_glib__application_service_server_object_info); |
388 | @@ -246,11 +255,11 @@ |
389 | app->aicon = g_value_dup_string(g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_AICON_NAME)); |
390 | } |
391 | |
392 | - gpointer icon_path_data = g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_ICON_PATH); |
393 | - if (icon_path_data != NULL) { |
394 | - app->icon_path = g_value_dup_string((GValue *)icon_path_data); |
395 | + gpointer icon_theme_path_data = g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_ICON_THEME_PATH); |
396 | + if (icon_theme_path_data != NULL) { |
397 | + app->icon_theme_path = g_value_dup_string((GValue *)icon_theme_path_data); |
398 | } else { |
399 | - app->icon_path = g_strdup(""); |
400 | + app->icon_theme_path = g_strdup(""); |
401 | } |
402 | |
403 | /* TODO: Calling approvers, but we're ignoring the results. So, eh. */ |
404 | @@ -346,8 +355,8 @@ |
405 | if (app->menu != NULL) { |
406 | g_free(app->menu); |
407 | } |
408 | - if (app->icon_path != NULL) { |
409 | - g_free(app->icon_path); |
410 | + if (app->icon_theme_path != NULL) { |
411 | + g_free(app->icon_theme_path); |
412 | } |
413 | |
414 | g_free(app); |
415 | @@ -445,7 +454,7 @@ |
416 | g_list_index(priv->applications, app), /* Position */ |
417 | app->dbus_name, |
418 | app->menu, |
419 | - app->icon_path, |
420 | + app->icon_theme_path, |
421 | TRUE); |
422 | } |
423 | } else { |
424 | @@ -540,6 +549,40 @@ |
425 | return; |
426 | } |
427 | |
428 | +/* Gets the data back on an updated icon theme path. |
429 | + Maybe a new icon */ |
430 | +static void |
431 | +new_icon_theme_path_cb (DBusGProxy * proxy, GValue value, GError * error, gpointer userdata) |
432 | +{ |
433 | + /* Check for errors */ |
434 | + if (error != NULL) { |
435 | + g_warning("Unable to get updated icon theme path: %s", error->message); |
436 | + return; |
437 | + } |
438 | + |
439 | + /* Grab the icon and make sure we have one */ |
440 | + const gchar * new_icon_theme_path = g_value_get_string(&value); |
441 | + |
442 | + Application * app = (Application *) userdata; |
443 | + |
444 | + if (g_strcmp0(new_icon_theme_path, app->icon_theme_path)) { |
445 | + /* If the new icon theme path is actually a new icon theme path */ |
446 | + if (app->icon_theme_path != NULL) g_free(app->icon_theme_path); |
447 | + app->icon_theme_path = g_strdup(new_icon_theme_path); |
448 | + |
449 | + if (app->status == APP_INDICATOR_STATUS_ACTIVE) { |
450 | + gint position = get_position(app); |
451 | + if (position == -1) return; |
452 | + |
453 | + g_signal_emit(G_OBJECT(app->appstore), |
454 | + signals[APPLICATION_ICON_THEME_PATH_CHANGED], 0, |
455 | + position, new_icon_theme_path, TRUE); |
456 | + } |
457 | + } |
458 | + |
459 | + return; |
460 | +} |
461 | + |
462 | /* Called when the Notification Item signals that it |
463 | has a new icon. */ |
464 | static void |
465 | @@ -586,6 +629,22 @@ |
466 | return; |
467 | } |
468 | |
469 | +/* Called when the Notification Item signals that it |
470 | + has a new icon theme path. */ |
471 | +static void |
472 | +new_icon_theme_path (DBusGProxy * proxy, gpointer data) |
473 | +{ |
474 | + Application * app = (Application *)data; |
475 | + if (!app->validated) return; |
476 | + |
477 | + org_freedesktop_DBus_Properties_get_async(app->prop_proxy, |
478 | + NOTIFICATION_ITEM_DBUS_IFACE, |
479 | + NOTIFICATION_ITEM_PROP_ICON_THEME_PATH, |
480 | + new_icon_theme_path_cb, |
481 | + app); |
482 | + return; |
483 | +} |
484 | + |
485 | /* Adding a new NotificationItem object from DBus in to the |
486 | appstore. First, we need to get the information on it |
487 | though. */ |
488 | @@ -612,7 +671,7 @@ |
489 | app->icon = NULL; |
490 | app->aicon = NULL; |
491 | app->menu = NULL; |
492 | - app->icon_path = NULL; |
493 | + app->icon_theme_path = NULL; |
494 | app->currently_free = FALSE; |
495 | |
496 | /* Get the DBus proxy for the NotificationItem interface */ |
497 | @@ -659,7 +718,10 @@ |
498 | NOTIFICATION_ITEM_SIG_NEW_STATUS, |
499 | G_TYPE_STRING, |
500 | G_TYPE_INVALID); |
501 | - |
502 | + dbus_g_proxy_add_signal(app->dbus_proxy, |
503 | + NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH, |
504 | + G_TYPE_INVALID); |
505 | + |
506 | dbus_g_proxy_connect_signal(app->dbus_proxy, |
507 | NOTIFICATION_ITEM_SIG_NEW_ICON, |
508 | G_CALLBACK(new_icon), |
509 | @@ -675,7 +737,12 @@ |
510 | G_CALLBACK(new_status), |
511 | app, |
512 | NULL); |
513 | - |
514 | + dbus_g_proxy_connect_signal(app->dbus_proxy, |
515 | + NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH, |
516 | + G_CALLBACK(new_icon_theme_path), |
517 | + app, |
518 | + NULL); |
519 | + |
520 | /* Get all the propertiees */ |
521 | org_freedesktop_DBus_Properties_get_all_async(app->prop_proxy, |
522 | NOTIFICATION_ITEM_DBUS_IFACE, |
523 | @@ -764,7 +831,7 @@ |
524 | |
525 | /* Icon path */ |
526 | g_value_init(&value, G_TYPE_STRING); |
527 | - g_value_set_string(&value, ((Application *)listpntr->data)->icon_path); |
528 | + g_value_set_string(&value, ((Application *)listpntr->data)->icon_theme_path); |
529 | g_value_array_append(values, &value); |
530 | g_value_unset(&value); |
531 | |
532 | |
533 | === modified file 'src/application-service-appstore.h' |
534 | --- src/application-service-appstore.h 2010-07-09 20:13:48 +0000 |
535 | +++ src/application-service-appstore.h 2010-07-22 17:41:15 +0000 |
536 | @@ -45,7 +45,8 @@ |
537 | |
538 | void (*application_added) (ApplicationServiceAppstore * appstore, gchar *, gint, gchar *, gchar *, gpointer); |
539 | void (*application_removed) (ApplicationServiceAppstore * appstore, gint, gpointer); |
540 | - void (*application_icon_changed)(ApplicationServiceAppstore * appstore, gint, const gchar *, gpointer); |
541 | + void (*application_icon_changed)(ApplicationServiceAppstore * appstore, gint, const gchar *, gpointer); |
542 | + void (*application_icon_theme_path_changed)(ApplicationServiceAppstore * appstore, gint, const gchar *, gpointer); |
543 | }; |
544 | |
545 | struct _ApplicationServiceAppstore { |
546 | |
547 | === modified file 'src/application-service.xml' |
548 | --- src/application-service.xml 2010-01-15 05:25:34 +0000 |
549 | +++ src/application-service.xml 2010-07-22 17:41:15 +0000 |
550 | @@ -44,6 +44,10 @@ |
551 | <arg type="i" name="position" direction="out" /> |
552 | <arg type="s" name="icon_name" direction="out" /> |
553 | </signal> |
554 | + <signal name="ApplicationIconThemePathChanged"> |
555 | + <arg type="i" name="position" direction="out" /> |
556 | + <arg type="s" name="icon_theme_path" direction="out" /> |
557 | + </signal> |
558 | |
559 | </interface> |
560 | </node> |
561 | |
562 | === modified file 'src/indicator-application.c' |
563 | --- src/indicator-application.c 2010-03-29 17:41:18 +0000 |
564 | +++ src/indicator-application.c 2010-07-22 17:41:15 +0000 |
565 | @@ -84,7 +84,8 @@ |
566 | typedef struct _ApplicationEntry ApplicationEntry; |
567 | struct _ApplicationEntry { |
568 | IndicatorObjectEntry entry; |
569 | - gchar * icon_path; |
570 | + gchar * icon_theme_path; |
571 | + gchar * icon_name; |
572 | gboolean old_service; |
573 | gchar * dbusobject; |
574 | gchar * dbusaddress; |
575 | @@ -105,9 +106,10 @@ |
576 | static void disconnected_helper (gpointer data, gpointer user_data); |
577 | static gboolean disconnected_kill (gpointer user_data); |
578 | static void disconnected_kill_helper (gpointer data, gpointer user_data); |
579 | -static void application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_path, IndicatorApplication * application); |
580 | +static void application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, IndicatorApplication * application); |
581 | static void application_removed (DBusGProxy * proxy, gint position , IndicatorApplication * application); |
582 | static void application_icon_changed (DBusGProxy * proxy, gint position, const gchar * iconname, IndicatorApplication * application); |
583 | +static void application_icon_theme_path_changed (DBusGProxy * proxy, gint position, const gchar * icon_theme_path, IndicatorApplication * application); |
584 | static void get_applications (DBusGProxy *proxy, GPtrArray *OUT_applications, GError *error, gpointer userdata); |
585 | static void get_applications_helper (gpointer data, gpointer user_data); |
586 | static void theme_dir_unref(IndicatorApplication * ia, const gchar * dir); |
587 | @@ -280,6 +282,11 @@ |
588 | G_TYPE_INT, |
589 | G_TYPE_STRING, |
590 | G_TYPE_INVALID); |
591 | + dbus_g_proxy_add_signal(priv->service_proxy, |
592 | + "ApplicationIconThemePathChanged", |
593 | + G_TYPE_INT, |
594 | + G_TYPE_STRING, |
595 | + G_TYPE_INVALID); |
596 | |
597 | /* Connect to them */ |
598 | g_debug("Connect to them."); |
599 | @@ -298,6 +305,11 @@ |
600 | G_CALLBACK(application_icon_changed), |
601 | application, |
602 | NULL /* Disconnection Signal */); |
603 | + dbus_g_proxy_connect_signal(priv->service_proxy, |
604 | + "ApplicationIconThemePathChanged", |
605 | + G_CALLBACK(application_icon_theme_path_changed), |
606 | + application, |
607 | + NULL /* Disconnection Signal */); |
608 | } |
609 | |
610 | /* Query it for existing applications */ |
611 | @@ -413,7 +425,7 @@ |
612 | ApplicationEntry and signaling the indicator host that |
613 | we've got a new indicator. */ |
614 | static void |
615 | -application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_path, IndicatorApplication * application) |
616 | +application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, IndicatorApplication * application) |
617 | { |
618 | g_return_if_fail(IS_INDICATOR_APPLICATION(application)); |
619 | g_debug("Building new application entry: %s with icon: %s", dbusaddress, iconname); |
620 | @@ -435,15 +447,16 @@ |
621 | ApplicationEntry * app = g_new(ApplicationEntry, 1); |
622 | |
623 | app->old_service = FALSE; |
624 | - app->icon_path = NULL; |
625 | - if (icon_path != NULL && icon_path[0] != '\0') { |
626 | - app->icon_path = g_strdup(icon_path); |
627 | - theme_dir_ref(application, icon_path); |
628 | + app->icon_theme_path = NULL; |
629 | + if (icon_theme_path != NULL && icon_theme_path[0] != '\0') { |
630 | + app->icon_theme_path = g_strdup(icon_theme_path); |
631 | + theme_dir_ref(application, icon_theme_path); |
632 | } |
633 | |
634 | app->dbusaddress = g_strdup(dbusaddress); |
635 | app->dbusobject = g_strdup(dbusobject); |
636 | |
637 | + app->icon_name = g_strdup(iconname); |
638 | /* We make a long name using the suffix, and if that |
639 | icon is available we want to use it. Otherwise we'll |
640 | just use the name we were given. */ |
641 | @@ -489,9 +502,9 @@ |
642 | priv->applications = g_list_remove(priv->applications, app); |
643 | g_signal_emit(G_OBJECT(application), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED_ID, 0, &(app->entry), TRUE); |
644 | |
645 | - if (app->icon_path != NULL) { |
646 | - theme_dir_unref(application, app->icon_path); |
647 | - g_free(app->icon_path); |
648 | + if (app->icon_theme_path != NULL) { |
649 | + theme_dir_unref(application, app->icon_theme_path); |
650 | + g_free(app->icon_theme_path); |
651 | } |
652 | if (app->dbusaddress != NULL) { |
653 | g_free(app->dbusaddress); |
654 | @@ -499,6 +512,9 @@ |
655 | if (app->dbusobject != NULL) { |
656 | g_free(app->dbusobject); |
657 | } |
658 | + if (app->icon_name != NULL) { |
659 | + g_free(app->icon_name); |
660 | + } |
661 | if (app->entry.image != NULL) { |
662 | g_object_unref(G_OBJECT(app->entry.image)); |
663 | } |
664 | @@ -533,6 +549,37 @@ |
665 | gchar * longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX); |
666 | indicator_image_helper_update(app->entry.image, longname); |
667 | g_free(longname); |
668 | + |
669 | + app->icon_name = g_strdup(iconname); |
670 | + |
671 | + return; |
672 | +} |
673 | + |
674 | +/* The callback for the signal that the icon theme path for an application |
675 | + has changed. */ |
676 | +static void |
677 | +application_icon_theme_path_changed (DBusGProxy * proxy, gint position, const gchar * icon_theme_path, IndicatorApplication * application) |
678 | +{ |
679 | + IndicatorApplicationPrivate * priv = INDICATOR_APPLICATION_GET_PRIVATE(application); |
680 | + ApplicationEntry * app = (ApplicationEntry *)g_list_nth_data(priv->applications, position); |
681 | + |
682 | + if (app == NULL) { |
683 | + g_warning("Unable to find application at position: %d", position); |
684 | + return; |
685 | + } |
686 | + |
687 | + if (g_strcmp0(icon_theme_path, app->icon_theme_path) != 0) { |
688 | + if(app->icon_theme_path != NULL) { |
689 | + theme_dir_unref(application, app->icon_theme_path); |
690 | + g_free(app->icon_theme_path); |
691 | + app->icon_theme_path = NULL; |
692 | + } |
693 | + if (icon_theme_path != NULL && icon_theme_path[0] != '\0') { |
694 | + app->icon_theme_path = g_strdup(icon_theme_path); |
695 | + theme_dir_ref(application, app->icon_theme_path); |
696 | + } |
697 | + indicator_image_helper_update(app->entry.image, app->icon_name); |
698 | + } |
699 | |
700 | return; |
701 | } |
702 | @@ -564,13 +611,13 @@ |
703 | gint position = g_value_get_int(g_value_array_get_nth(array, 1)); |
704 | const gchar * dbus_address = g_value_get_string(g_value_array_get_nth(array, 2)); |
705 | const gchar * dbus_object = g_value_get_boxed(g_value_array_get_nth(array, 3)); |
706 | - const gchar * icon_path = g_value_get_string(g_value_array_get_nth(array, 4)); |
707 | + const gchar * icon_theme_path = g_value_get_string(g_value_array_get_nth(array, 4)); |
708 | |
709 | - return application_added(NULL, icon_name, position, dbus_address, dbus_object, icon_path, user_data); |
710 | + return application_added(NULL, icon_name, position, dbus_address, dbus_object, icon_theme_path, user_data); |
711 | } |
712 | |
713 | -/* Refs a theme directory, and it may add it to the search |
714 | - path */ |
715 | +/* Unrefs a theme directory. This may involve removing it from |
716 | + the search path. */ |
717 | static void |
718 | theme_dir_unref(IndicatorApplication * ia, const gchar * dir) |
719 | { |
720 | @@ -629,8 +676,8 @@ |
721 | return; |
722 | } |
723 | |
724 | -/* Unrefs a theme directory. This may involve removing it from |
725 | - the search path. */ |
726 | +/* Refs a theme directory, and it may add it to the search |
727 | + path */ |
728 | static void |
729 | theme_dir_ref(IndicatorApplication * ia, const gchar * dir) |
730 | { |
731 | |
732 | === modified file 'src/notification-item.xml' |
733 | --- src/notification-item.xml 2010-03-15 17:10:43 +0000 |
734 | +++ src/notification-item.xml 2010-07-22 17:41:15 +0000 |
735 | @@ -19,6 +19,8 @@ |
736 | <!-- Signals --> |
737 | <signal name="NewIcon"> |
738 | </signal> |
739 | + <signal name="NewIconThemePath"> |
740 | + </signal> |
741 | <signal name="NewAttentionIcon"> |
742 | </signal> |
743 | <signal name="NewStatus"> |
What do you guys think about changing the signal to include the path in it, that's save a DBus call. From:
+ <signal name="NewIconTh emePath" >
+ </signal>
To:
<signal name="NewIconTh emePath" > theme_path" direction="out" />
<arg type="s" name="icon_
</signal>
The others don't have properties becasue they could represent a few values changing, but this signal seems to be 1:1 with the theme path, so I'm thinking just send it.
Thoughts?