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