Merge lp:~c10ud/indicator-application/runtime-themepath-change into lp:indicator-application/0.4

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
Reviewer Review Type Date Requested Status
Indicator Applet Developers Pending
Review via email: mp+30695@code.launchpad.net

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 :

What do you guys think about changing the signal to include the path in it, that's save a DBus call. From:

+ <signal name="NewIconThemePath">
+ </signal>

To:

<signal name="NewIconThemePath">
<arg type="s" name="icon_theme_path" direction="out" />
</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?

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bindings/mono/libappindicator-api.metadata'
--- bindings/mono/libappindicator-api.metadata 2010-05-23 10:44:53 +0000
+++ bindings/mono/libappindicator-api.metadata 2010-07-22 17:41:15 +0000
@@ -9,6 +9,8 @@
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>
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>
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>
12 <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_icon_theme_path']" name="name">NewIconThemePath</attr>
13 <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_icon_theme_path']" name="cname">new-icon-theme-path</attr>
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>
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>
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>
@@ -26,16 +28,18 @@
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>
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>
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>
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>
3032
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']" />
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']" />
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']" />
36 <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_icon_theme_path']" />
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']" />
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']" />
3639
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']" />
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']" />
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']" />
43 <remove-node path="/api/namespace/object/method[@cname='app_indicator_set_icon_theme_path']" />
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']" />
41</metadata>45</metadata>
4246
=== modified file 'bindings/python/appindicator.defs'
--- bindings/python/appindicator.defs 2010-03-30 19:09:04 +0000
+++ bindings/python/appindicator.defs 2010-07-22 17:41:15 +0000
@@ -49,7 +49,7 @@
49 '("const-gchar*" "id")49 '("const-gchar*" "id")
50 '("const-gchar*" "icon_name")50 '("const-gchar*" "icon_name")
51 '("AppIndicatorCategory" "category")51 '("AppIndicatorCategory" "category")
52 '("const-gchar*" "icon_path" (null-ok) (default "NULL"))52 '("const-gchar*" "icon_theme_path" (null-ok) (default "NULL"))
53 )53 )
54)54)
5555
@@ -89,6 +89,15 @@
89 )89 )
90)90)
9191
92(define-method set_icon_theme_path
93 (of-object "AppIndicator")
94 (c-name "app_indicator_set_icon_theme_path")
95 (return-type "none")
96 (parameters
97 '("const-gchar*" "icon_theme_path" (null-ok))
98 )
99)
100
92(define-method get_id101(define-method get_id
93 (of-object "AppIndicator")102 (of-object "AppIndicator")
94 (c-name "app_indicator_get_id")103 (c-name "app_indicator_get_id")
@@ -113,6 +122,12 @@
113 (return-type "const-gchar*")122 (return-type "const-gchar*")
114)123)
115124
125(define-method get_icon_theme_path
126 (of-object "AppIndicator")
127 (c-name "app_indicator_get_icon_theme_path")
128 (return-type "const-gchar*")
129)
130
116(define-method get_attention_icon131(define-method get_attention_icon
117 (of-object "AppIndicator")132 (of-object "AppIndicator")
118 (c-name "app_indicator_get_attention_icon")133 (c-name "app_indicator_get_attention_icon")
119134
=== modified file 'src/app-indicator.c'
--- src/app-indicator.c 2010-07-07 19:17:31 +0000
+++ src/app-indicator.c 2010-07-22 17:41:15 +0000
@@ -69,7 +69,7 @@
69 AppIndicatorStatus status;69 AppIndicatorStatus status;
70 gchar *icon_name;70 gchar *icon_name;
71 gchar *attention_icon_name;71 gchar *attention_icon_name;
72 gchar * icon_path;72 gchar *icon_theme_path;
73 DbusmenuServer *menuservice;73 DbusmenuServer *menuservice;
74 GtkWidget *menu;74 GtkWidget *menu;
7575
@@ -88,6 +88,7 @@
88 NEW_ATTENTION_ICON,88 NEW_ATTENTION_ICON,
89 NEW_STATUS,89 NEW_STATUS,
90 CONNECTION_CHANGED,90 CONNECTION_CHANGED,
91 NEW_ICON_THEME_PATH,
91 LAST_SIGNAL92 LAST_SIGNAL
92};93};
9394
@@ -229,7 +230,7 @@
229 "An icon for the indicator",230 "An icon for the indicator",
230 "The default icon that is shown for the indicator.",231 "The default icon that is shown for the indicator.",
231 NULL,232 NULL,
232 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));233 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT));
233234
234 /**235 /**
235 AppIndicator:attention-icon-name:236 AppIndicator:attention-icon-name:
@@ -256,7 +257,7 @@
256 "An additional path for custom icons.",257 "An additional path for custom icons.",
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.",
258 NULL,259 NULL,
259 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY));260 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT));
260 261
261 /**262 /**
262 AppIndicator:menu:263 AppIndicator:menu:
@@ -347,6 +348,21 @@
347 g_cclosure_marshal_VOID__BOOLEAN,348 g_cclosure_marshal_VOID__BOOLEAN,
348 G_TYPE_NONE, 1, G_TYPE_BOOLEAN, G_TYPE_NONE);349 G_TYPE_NONE, 1, G_TYPE_BOOLEAN, G_TYPE_NONE);
349350
351 /**
352 AppIndicator::new-icon-theme-path:
353 @arg0: The #AppIndicator object
354
355 Signaled when there is a new icon set for the
356 object.
357 */
358 signals[NEW_ICON_THEME_PATH] = g_signal_new (APP_INDICATOR_SIGNAL_NEW_ICON_THEME_PATH,
359 G_TYPE_FROM_CLASS(klass),
360 G_SIGNAL_RUN_LAST,
361 G_STRUCT_OFFSET (AppIndicatorClass, new_icon_theme_path),
362 NULL, NULL,
363 g_cclosure_marshal_VOID__VOID,
364 G_TYPE_NONE, 0, G_TYPE_NONE);
365
350 /* Initialize the object as a DBus type */366 /* Initialize the object as a DBus type */
351 dbus_g_object_type_install_info(APP_INDICATOR_TYPE,367 dbus_g_object_type_install_info(APP_INDICATOR_TYPE,
352 &dbus_glib__notification_item_server_object_info);368 &dbus_glib__notification_item_server_object_info);
@@ -365,7 +381,7 @@
365 priv->status = APP_INDICATOR_STATUS_PASSIVE;381 priv->status = APP_INDICATOR_STATUS_PASSIVE;
366 priv->icon_name = NULL;382 priv->icon_name = NULL;
367 priv->attention_icon_name = NULL;383 priv->attention_icon_name = NULL;
368 priv->icon_path = NULL;384 priv->icon_theme_path = NULL;
369 priv->menu = NULL;385 priv->menu = NULL;
370 priv->menuservice = NULL;386 priv->menuservice = NULL;
371387
@@ -487,9 +503,9 @@
487 priv->attention_icon_name = NULL;503 priv->attention_icon_name = NULL;
488 }504 }
489505
490 if (priv->icon_path != NULL) {506 if (priv->icon_theme_path != NULL) {
491 g_free(priv->icon_path);507 g_free(priv->icon_theme_path);
492 priv->icon_path = NULL;508 priv->icon_theme_path = NULL;
493 }509 }
494510
495 G_OBJECT_CLASS (app_indicator_parent_class)->finalize (object);511 G_OBJECT_CLASS (app_indicator_parent_class)->finalize (object);
@@ -557,10 +573,9 @@
557 break;573 break;
558574
559 case PROP_ICON_THEME_PATH:575 case PROP_ICON_THEME_PATH:
560 if (priv->icon_path != NULL) {576 app_indicator_set_icon_theme_path (APP_INDICATOR (object),
561 g_free(priv->icon_path);577 g_value_get_string (value));
562 }578 check_connect (self);
563 priv->icon_path = g_value_dup_string(value);
564 break;579 break;
565580
566 default:581 default:
@@ -603,7 +618,7 @@
603 break;618 break;
604619
605 case PROP_ICON_THEME_PATH:620 case PROP_ICON_THEME_PATH:
606 g_value_set_string (value, priv->icon_path);621 g_value_set_string (value, priv->icon_theme_path);
607 break;622 break;
608623
609 case PROP_MENU:624 case PROP_MENU:
@@ -1025,12 +1040,12 @@
1025 @id: The unique id of the indicator to create.1040 @id: The unique id of the indicator to create.
1026 @icon_name: The icon name for this indicator1041 @icon_name: The icon name for this indicator
1027 @category: The category of indicator.1042 @category: The category of indicator.
1028 @icon_path: A custom path for finding icons.1043 @icon_theme_path: A custom path for finding icons.
10291044
1030 Creates a new #AppIndicator setting the properties:1045 Creates a new #AppIndicator setting the properties:
1031 #AppIndicator:id with @id, #AppIndicator:category1046 #AppIndicator:id with @id, #AppIndicator:category
1032 with @category, #AppIndicator:icon-name with1047 with @category, #AppIndicator:icon-name with
1033 @icon_name and #AppIndicator:icon-theme-path with @icon_path.1048 @icon_name and #AppIndicator:icon-theme-path with @icon_theme_path.
10341049
1035 Return value: A pointer to a new #AppIndicator object.1050 Return value: A pointer to a new #AppIndicator object.
1036 */1051 */
@@ -1038,13 +1053,13 @@
1038app_indicator_new_with_path (const gchar *id,1053app_indicator_new_with_path (const gchar *id,
1039 const gchar *icon_name,1054 const gchar *icon_name,
1040 AppIndicatorCategory category,1055 AppIndicatorCategory category,
1041 const gchar *icon_path)1056 const gchar *icon_theme_path)
1042{1057{
1043 AppIndicator *indicator = g_object_new (APP_INDICATOR_TYPE,1058 AppIndicator *indicator = g_object_new (APP_INDICATOR_TYPE,
1044 PROP_ID_S, id,1059 PROP_ID_S, id,
1045 PROP_CATEGORY_S, category_from_enum (category),1060 PROP_CATEGORY_S, category_from_enum (category),
1046 PROP_ICON_NAME_S, icon_name,1061 PROP_ICON_NAME_S, icon_name,
1047 PROP_ICON_THEME_PATH_S, icon_path,1062 PROP_ICON_THEME_PATH_S, icon_theme_path,
1048 NULL);1063 NULL);
10491064
1050 return indicator;1065 return indicator;
@@ -1134,6 +1149,31 @@
1134 return;1149 return;
1135}1150}
11361151
1152/**
1153 app_indicator_set_icon_theme_path:
1154 @self: The #AppIndicator object to use
1155 @icon_theme_path: The icon theme path to set.
1156
1157 Sets the path to use when searching for icons.
1158**/
1159void
1160app_indicator_set_icon_theme_path (AppIndicator *self, const gchar *icon_theme_path)
1161{
1162 g_return_if_fail (IS_APP_INDICATOR (self));
1163
1164 if (g_strcmp0 (self->priv->icon_theme_path, icon_theme_path) != 0)
1165 {
1166 if (self->priv->icon_theme_path != NULL)
1167 g_free(self->priv->icon_theme_path);
1168
1169 self->priv->icon_theme_path = g_strdup(icon_theme_path);
1170
1171 g_signal_emit (self, signals[NEW_ICON_THEME_PATH], 0, TRUE);
1172 }
1173
1174 return;
1175}
1176
1137static void1177static void
1138activate_menuitem (DbusmenuMenuitem *mi, guint timestamp, gpointer user_data)1178activate_menuitem (DbusmenuMenuitem *mi, guint timestamp, gpointer user_data)
1139{1179{
@@ -1626,6 +1666,22 @@
1626}1666}
16271667
1628/**1668/**
1669 app_indicator_get_icon_theme_path:
1670 @self: The #AppIndicator object to use
1671
1672 Wrapper function for property #AppIndicator:icon-theme-path.
1673
1674 Return value: The current icon theme path.
1675*/
1676const gchar *
1677app_indicator_get_icon_theme_path (AppIndicator *self)
1678{
1679 g_return_val_if_fail (IS_APP_INDICATOR (self), NULL);
1680
1681 return self->priv->icon_theme_path;
1682}
1683
1684/**
1629 app_indicator_get_attention_icon:1685 app_indicator_get_attention_icon:
1630 @self: The #AppIndicator object to use1686 @self: The #AppIndicator object to use
16311687
16321688
=== modified file 'src/app-indicator.h'
--- src/app-indicator.h 2010-05-23 10:44:53 +0000
+++ src/app-indicator.h 2010-07-22 17:41:15 +0000
@@ -69,6 +69,7 @@
6969
70 Gets a pointer to the #AppIndicatorClass for the object @obj.70 Gets a pointer to the #AppIndicatorClass for the object @obj.
71*/71*/
72
72#define APP_INDICATOR_TYPE (app_indicator_get_type ())73#define APP_INDICATOR_TYPE (app_indicator_get_type ())
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))
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))
@@ -96,10 +97,16 @@
9697
97 String identifier for the #AppIndicator::connection-changed signal.98 String identifier for the #AppIndicator::connection-changed signal.
98*/99*/
100/**
101 APP_INDICATOR_SIGNAL_NEW_ICON_THEME_PATH:
102
103 String identifier for the #AppIndicator::new-icon-theme-path signal.
104*/
99#define APP_INDICATOR_SIGNAL_NEW_ICON "new-icon"105#define APP_INDICATOR_SIGNAL_NEW_ICON "new-icon"
100#define APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON "new-attention-icon"106#define APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON "new-attention-icon"
101#define APP_INDICATOR_SIGNAL_NEW_STATUS "new-status"107#define APP_INDICATOR_SIGNAL_NEW_STATUS "new-status"
102#define APP_INDICATOR_SIGNAL_CONNECTION_CHANGED "connection-changed"108#define APP_INDICATOR_SIGNAL_CONNECTION_CHANGED "connection-changed"
109#define APP_INDICATOR_SIGNAL_NEW_ICON_THEME_PATH "new-icon-theme-path"
103110
104/**111/**
105 AppIndicatorCategory:112 AppIndicatorCategory:
@@ -147,6 +154,7 @@
147 @new_icon: Slot for #AppIndicator::new-icon.154 @new_icon: Slot for #AppIndicator::new-icon.
148 @new_attention_icon: Slot for #AppIndicator::new-attention-icon.155 @new_attention_icon: Slot for #AppIndicator::new-attention-icon.
149 @new_status: Slot for #AppIndicator::new-status.156 @new_status: Slot for #AppIndicator::new-status.
157 @new_icon_theme_path: Slot for #AppIndicator::new-icon-theme-path
150 @connection_changed: Slot for #AppIndicator::connection-changed.158 @connection_changed: Slot for #AppIndicator::connection-changed.
151 @fallback: Function that gets called to make a #GtkStatusIcon when159 @fallback: Function that gets called to make a #GtkStatusIcon when
152 there is no Application Indicator area available.160 there is no Application Indicator area available.
@@ -170,6 +178,8 @@
170 void (* new_status) (AppIndicator *indicator,178 void (* new_status) (AppIndicator *indicator,
171 const gchar *status,179 const gchar *status,
172 gpointer user_data);180 gpointer user_data);
181 void (* new_icon_theme_path) (AppIndicator *indicator,
182 gpointer user_data);
173183
174 /* Local Signals */184 /* Local Signals */
175 void (* connection_changed) (AppIndicator * indicator,185 void (* connection_changed) (AppIndicator * indicator,
@@ -215,7 +225,7 @@
215AppIndicator *app_indicator_new_with_path (const gchar *id,225AppIndicator *app_indicator_new_with_path (const gchar *id,
216 const gchar *icon_name,226 const gchar *icon_name,
217 AppIndicatorCategory category,227 AppIndicatorCategory category,
218 const gchar *icon_path);228 const gchar *icon_theme_path);
219229
220/* Set properties */230/* Set properties */
221void app_indicator_set_status (AppIndicator *self,231void app_indicator_set_status (AppIndicator *self,
@@ -226,12 +236,15 @@
226 GtkMenu *menu);236 GtkMenu *menu);
227void app_indicator_set_icon (AppIndicator *self,237void app_indicator_set_icon (AppIndicator *self,
228 const gchar *icon_name);238 const gchar *icon_name);
239void app_indicator_set_icon_theme_path(AppIndicator *self,
240 const gchar *icon_theme_path);
229241
230/* Get properties */242/* Get properties */
231const gchar * app_indicator_get_id (AppIndicator *self);243const gchar * app_indicator_get_id (AppIndicator *self);
232AppIndicatorCategory app_indicator_get_category (AppIndicator *self);244AppIndicatorCategory app_indicator_get_category (AppIndicator *self);
233AppIndicatorStatus app_indicator_get_status (AppIndicator *self);245AppIndicatorStatus app_indicator_get_status (AppIndicator *self);
234const gchar * app_indicator_get_icon (AppIndicator *self);246const gchar * app_indicator_get_icon (AppIndicator *self);
247const gchar * app_indicator_get_icon_theme_path(AppIndicator *self);
235const gchar * app_indicator_get_attention_icon (AppIndicator *self);248const gchar * app_indicator_get_attention_icon (AppIndicator *self);
236GtkMenu * app_indicator_get_menu (AppIndicator *self);249GtkMenu * app_indicator_get_menu (AppIndicator *self);
237250
238251
=== modified file 'src/application-service-appstore.c'
--- src/application-service-appstore.c 2010-07-09 21:29:22 +0000
+++ src/application-service-appstore.c 2010-07-22 17:41:15 +0000
@@ -43,12 +43,13 @@
43#define NOTIFICATION_ITEM_PROP_STATUS "Status"43#define NOTIFICATION_ITEM_PROP_STATUS "Status"
44#define NOTIFICATION_ITEM_PROP_ICON_NAME "IconName"44#define NOTIFICATION_ITEM_PROP_ICON_NAME "IconName"
45#define NOTIFICATION_ITEM_PROP_AICON_NAME "AttentionIconName"45#define NOTIFICATION_ITEM_PROP_AICON_NAME "AttentionIconName"
46#define NOTIFICATION_ITEM_PROP_ICON_PATH "IconThemePath"46#define NOTIFICATION_ITEM_PROP_ICON_THEME_PATH "IconThemePath"
47#define NOTIFICATION_ITEM_PROP_MENU "Menu"47#define NOTIFICATION_ITEM_PROP_MENU "Menu"
4848
49#define NOTIFICATION_ITEM_SIG_NEW_ICON "NewIcon"49#define NOTIFICATION_ITEM_SIG_NEW_ICON "NewIcon"
50#define NOTIFICATION_ITEM_SIG_NEW_AICON "NewAttentionIcon"50#define NOTIFICATION_ITEM_SIG_NEW_AICON "NewAttentionIcon"
51#define NOTIFICATION_ITEM_SIG_NEW_STATUS "NewStatus"51#define NOTIFICATION_ITEM_SIG_NEW_STATUS "NewStatus"
52#define NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH "NewIconThemePath"
5253
53/* Private Stuff */54/* Private Stuff */
54struct _ApplicationServiceAppstorePrivate {55struct _ApplicationServiceAppstorePrivate {
@@ -77,7 +78,7 @@
77 gchar * icon;78 gchar * icon;
78 gchar * aicon;79 gchar * aicon;
79 gchar * menu;80 gchar * menu;
80 gchar * icon_path;81 gchar * icon_theme_path;
81 gboolean currently_free;82 gboolean currently_free;
82};83};
8384
@@ -89,6 +90,7 @@
89 APPLICATION_ADDED,90 APPLICATION_ADDED,
90 APPLICATION_REMOVED,91 APPLICATION_REMOVED,
91 APPLICATION_ICON_CHANGED,92 APPLICATION_ICON_CHANGED,
93 APPLICATION_ICON_THEME_PATH_CHANGED,
92 LAST_SIGNAL94 LAST_SIGNAL
93};95};
9496
@@ -138,6 +140,13 @@
138 NULL, NULL,140 NULL, NULL,
139 _application_service_marshal_VOID__INT_STRING,141 _application_service_marshal_VOID__INT_STRING,
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);
143 signals[APPLICATION_ICON_THEME_PATH_CHANGED] = g_signal_new ("application-icon-theme-path-changed",
144 G_TYPE_FROM_CLASS(klass),
145 G_SIGNAL_RUN_LAST,
146 G_STRUCT_OFFSET (ApplicationServiceAppstoreClass, application_icon_theme_path_changed),
147 NULL, NULL,
148 _application_service_marshal_VOID__INT_STRING,
149 G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_STRING, G_TYPE_NONE);
141150
142 dbus_g_object_type_install_info(APPLICATION_SERVICE_APPSTORE_TYPE,151 dbus_g_object_type_install_info(APPLICATION_SERVICE_APPSTORE_TYPE,
143 &dbus_glib__application_service_server_object_info);152 &dbus_glib__application_service_server_object_info);
@@ -246,11 +255,11 @@
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));
247 }256 }
248257
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);
250 if (icon_path_data != NULL) {259 if (icon_theme_path_data != NULL) {
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);
252 } else {261 } else {
253 app->icon_path = g_strdup("");262 app->icon_theme_path = g_strdup("");
254 }263 }
255264
256 /* TODO: Calling approvers, but we're ignoring the results. So, eh. */265 /* TODO: Calling approvers, but we're ignoring the results. So, eh. */
@@ -346,8 +355,8 @@
346 if (app->menu != NULL) {355 if (app->menu != NULL) {
347 g_free(app->menu);356 g_free(app->menu);
348 }357 }
349 if (app->icon_path != NULL) {358 if (app->icon_theme_path != NULL) {
350 g_free(app->icon_path);359 g_free(app->icon_theme_path);
351 }360 }
352361
353 g_free(app);362 g_free(app);
@@ -445,7 +454,7 @@
445 g_list_index(priv->applications, app), /* Position */454 g_list_index(priv->applications, app), /* Position */
446 app->dbus_name,455 app->dbus_name,
447 app->menu,456 app->menu,
448 app->icon_path,457 app->icon_theme_path,
449 TRUE);458 TRUE);
450 }459 }
451 } else {460 } else {
@@ -540,6 +549,40 @@
540 return;549 return;
541}550}
542551
552/* Gets the data back on an updated icon theme path.
553 Maybe a new icon */
554static void
555new_icon_theme_path_cb (DBusGProxy * proxy, GValue value, GError * error, gpointer userdata)
556{
557 /* Check for errors */
558 if (error != NULL) {
559 g_warning("Unable to get updated icon theme path: %s", error->message);
560 return;
561 }
562
563 /* Grab the icon and make sure we have one */
564 const gchar * new_icon_theme_path = g_value_get_string(&value);
565
566 Application * app = (Application *) userdata;
567
568 if (g_strcmp0(new_icon_theme_path, app->icon_theme_path)) {
569 /* If the new icon theme path is actually a new icon theme path */
570 if (app->icon_theme_path != NULL) g_free(app->icon_theme_path);
571 app->icon_theme_path = g_strdup(new_icon_theme_path);
572
573 if (app->status == APP_INDICATOR_STATUS_ACTIVE) {
574 gint position = get_position(app);
575 if (position == -1) return;
576
577 g_signal_emit(G_OBJECT(app->appstore),
578 signals[APPLICATION_ICON_THEME_PATH_CHANGED], 0,
579 position, new_icon_theme_path, TRUE);
580 }
581 }
582
583 return;
584}
585
543/* Called when the Notification Item signals that it586/* Called when the Notification Item signals that it
544 has a new icon. */587 has a new icon. */
545static void588static void
@@ -586,6 +629,22 @@
586 return;629 return;
587}630}
588631
632/* Called when the Notification Item signals that it
633 has a new icon theme path. */
634static void
635new_icon_theme_path (DBusGProxy * proxy, gpointer data)
636{
637 Application * app = (Application *)data;
638 if (!app->validated) return;
639
640 org_freedesktop_DBus_Properties_get_async(app->prop_proxy,
641 NOTIFICATION_ITEM_DBUS_IFACE,
642 NOTIFICATION_ITEM_PROP_ICON_THEME_PATH,
643 new_icon_theme_path_cb,
644 app);
645 return;
646}
647
589/* Adding a new NotificationItem object from DBus in to the648/* Adding a new NotificationItem object from DBus in to the
590 appstore. First, we need to get the information on it649 appstore. First, we need to get the information on it
591 though. */650 though. */
@@ -612,7 +671,7 @@
612 app->icon = NULL;671 app->icon = NULL;
613 app->aicon = NULL;672 app->aicon = NULL;
614 app->menu = NULL;673 app->menu = NULL;
615 app->icon_path = NULL;674 app->icon_theme_path = NULL;
616 app->currently_free = FALSE;675 app->currently_free = FALSE;
617676
618 /* Get the DBus proxy for the NotificationItem interface */677 /* Get the DBus proxy for the NotificationItem interface */
@@ -659,7 +718,10 @@
659 NOTIFICATION_ITEM_SIG_NEW_STATUS,718 NOTIFICATION_ITEM_SIG_NEW_STATUS,
660 G_TYPE_STRING,719 G_TYPE_STRING,
661 G_TYPE_INVALID);720 G_TYPE_INVALID);
662721 dbus_g_proxy_add_signal(app->dbus_proxy,
722 NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH,
723 G_TYPE_INVALID);
724
663 dbus_g_proxy_connect_signal(app->dbus_proxy,725 dbus_g_proxy_connect_signal(app->dbus_proxy,
664 NOTIFICATION_ITEM_SIG_NEW_ICON,726 NOTIFICATION_ITEM_SIG_NEW_ICON,
665 G_CALLBACK(new_icon),727 G_CALLBACK(new_icon),
@@ -675,7 +737,12 @@
675 G_CALLBACK(new_status),737 G_CALLBACK(new_status),
676 app,738 app,
677 NULL);739 NULL);
678740 dbus_g_proxy_connect_signal(app->dbus_proxy,
741 NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH,
742 G_CALLBACK(new_icon_theme_path),
743 app,
744 NULL);
745
679 /* Get all the propertiees */746 /* Get all the propertiees */
680 org_freedesktop_DBus_Properties_get_all_async(app->prop_proxy,747 org_freedesktop_DBus_Properties_get_all_async(app->prop_proxy,
681 NOTIFICATION_ITEM_DBUS_IFACE,748 NOTIFICATION_ITEM_DBUS_IFACE,
@@ -764,7 +831,7 @@
764831
765 /* Icon path */832 /* Icon path */
766 g_value_init(&value, G_TYPE_STRING);833 g_value_init(&value, G_TYPE_STRING);
767 g_value_set_string(&value, ((Application *)listpntr->data)->icon_path);834 g_value_set_string(&value, ((Application *)listpntr->data)->icon_theme_path);
768 g_value_array_append(values, &value);835 g_value_array_append(values, &value);
769 g_value_unset(&value);836 g_value_unset(&value);
770837
771838
=== modified file 'src/application-service-appstore.h'
--- src/application-service-appstore.h 2010-07-09 20:13:48 +0000
+++ src/application-service-appstore.h 2010-07-22 17:41:15 +0000
@@ -45,7 +45,8 @@
4545
46 void (*application_added) (ApplicationServiceAppstore * appstore, gchar *, gint, gchar *, gchar *, gpointer);46 void (*application_added) (ApplicationServiceAppstore * appstore, gchar *, gint, gchar *, gchar *, gpointer);
47 void (*application_removed) (ApplicationServiceAppstore * appstore, gint, gpointer);47 void (*application_removed) (ApplicationServiceAppstore * appstore, gint, gpointer);
48 void (*application_icon_changed)(ApplicationServiceAppstore * appstore, gint, const gchar *, gpointer);48 void (*application_icon_changed)(ApplicationServiceAppstore * appstore, gint, const gchar *, gpointer);
49 void (*application_icon_theme_path_changed)(ApplicationServiceAppstore * appstore, gint, const gchar *, gpointer);
49};50};
5051
51struct _ApplicationServiceAppstore {52struct _ApplicationServiceAppstore {
5253
=== modified file 'src/application-service.xml'
--- src/application-service.xml 2010-01-15 05:25:34 +0000
+++ src/application-service.xml 2010-07-22 17:41:15 +0000
@@ -44,6 +44,10 @@
44 <arg type="i" name="position" direction="out" />44 <arg type="i" name="position" direction="out" />
45 <arg type="s" name="icon_name" direction="out" />45 <arg type="s" name="icon_name" direction="out" />
46 </signal>46 </signal>
47 <signal name="ApplicationIconThemePathChanged">
48 <arg type="i" name="position" direction="out" />
49 <arg type="s" name="icon_theme_path" direction="out" />
50 </signal>
4751
48 </interface>52 </interface>
49</node>53</node>
5054
=== modified file 'src/indicator-application.c'
--- src/indicator-application.c 2010-03-29 17:41:18 +0000
+++ src/indicator-application.c 2010-07-22 17:41:15 +0000
@@ -84,7 +84,8 @@
84typedef struct _ApplicationEntry ApplicationEntry;84typedef struct _ApplicationEntry ApplicationEntry;
85struct _ApplicationEntry {85struct _ApplicationEntry {
86 IndicatorObjectEntry entry;86 IndicatorObjectEntry entry;
87 gchar * icon_path;87 gchar * icon_theme_path;
88 gchar * icon_name;
88 gboolean old_service;89 gboolean old_service;
89 gchar * dbusobject;90 gchar * dbusobject;
90 gchar * dbusaddress;91 gchar * dbusaddress;
@@ -105,9 +106,10 @@
105static void disconnected_helper (gpointer data, gpointer user_data);106static void disconnected_helper (gpointer data, gpointer user_data);
106static gboolean disconnected_kill (gpointer user_data);107static gboolean disconnected_kill (gpointer user_data);
107static void disconnected_kill_helper (gpointer data, gpointer user_data);108static void disconnected_kill_helper (gpointer data, gpointer user_data);
108static void application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_path, IndicatorApplication * application);109static void application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, IndicatorApplication * application);
109static void application_removed (DBusGProxy * proxy, gint position , IndicatorApplication * application);110static void application_removed (DBusGProxy * proxy, gint position , IndicatorApplication * application);
110static void application_icon_changed (DBusGProxy * proxy, gint position, const gchar * iconname, IndicatorApplication * application);111static void application_icon_changed (DBusGProxy * proxy, gint position, const gchar * iconname, IndicatorApplication * application);
112static void application_icon_theme_path_changed (DBusGProxy * proxy, gint position, const gchar * icon_theme_path, IndicatorApplication * application);
111static void get_applications (DBusGProxy *proxy, GPtrArray *OUT_applications, GError *error, gpointer userdata);113static void get_applications (DBusGProxy *proxy, GPtrArray *OUT_applications, GError *error, gpointer userdata);
112static void get_applications_helper (gpointer data, gpointer user_data);114static void get_applications_helper (gpointer data, gpointer user_data);
113static void theme_dir_unref(IndicatorApplication * ia, const gchar * dir);115static void theme_dir_unref(IndicatorApplication * ia, const gchar * dir);
@@ -280,6 +282,11 @@
280 G_TYPE_INT,282 G_TYPE_INT,
281 G_TYPE_STRING,283 G_TYPE_STRING,
282 G_TYPE_INVALID);284 G_TYPE_INVALID);
285 dbus_g_proxy_add_signal(priv->service_proxy,
286 "ApplicationIconThemePathChanged",
287 G_TYPE_INT,
288 G_TYPE_STRING,
289 G_TYPE_INVALID);
283290
284 /* Connect to them */291 /* Connect to them */
285 g_debug("Connect to them.");292 g_debug("Connect to them.");
@@ -298,6 +305,11 @@
298 G_CALLBACK(application_icon_changed),305 G_CALLBACK(application_icon_changed),
299 application,306 application,
300 NULL /* Disconnection Signal */);307 NULL /* Disconnection Signal */);
308 dbus_g_proxy_connect_signal(priv->service_proxy,
309 "ApplicationIconThemePathChanged",
310 G_CALLBACK(application_icon_theme_path_changed),
311 application,
312 NULL /* Disconnection Signal */);
301 }313 }
302314
303 /* Query it for existing applications */315 /* Query it for existing applications */
@@ -413,7 +425,7 @@
413 ApplicationEntry and signaling the indicator host that425 ApplicationEntry and signaling the indicator host that
414 we've got a new indicator. */426 we've got a new indicator. */
415static void427static void
416application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_path, IndicatorApplication * application)428application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, IndicatorApplication * application)
417{429{
418 g_return_if_fail(IS_INDICATOR_APPLICATION(application));430 g_return_if_fail(IS_INDICATOR_APPLICATION(application));
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);
@@ -435,15 +447,16 @@
435 ApplicationEntry * app = g_new(ApplicationEntry, 1);447 ApplicationEntry * app = g_new(ApplicationEntry, 1);
436448
437 app->old_service = FALSE;449 app->old_service = FALSE;
438 app->icon_path = NULL;450 app->icon_theme_path = NULL;
439 if (icon_path != NULL && icon_path[0] != '\0') {451 if (icon_theme_path != NULL && icon_theme_path[0] != '\0') {
440 app->icon_path = g_strdup(icon_path);452 app->icon_theme_path = g_strdup(icon_theme_path);
441 theme_dir_ref(application, icon_path);453 theme_dir_ref(application, icon_theme_path);
442 }454 }
443455
444 app->dbusaddress = g_strdup(dbusaddress);456 app->dbusaddress = g_strdup(dbusaddress);
445 app->dbusobject = g_strdup(dbusobject);457 app->dbusobject = g_strdup(dbusobject);
446458
459 app->icon_name = g_strdup(iconname);
447 /* We make a long name using the suffix, and if that460 /* We make a long name using the suffix, and if that
448 icon is available we want to use it. Otherwise we'll461 icon is available we want to use it. Otherwise we'll
449 just use the name we were given. */462 just use the name we were given. */
@@ -489,9 +502,9 @@
489 priv->applications = g_list_remove(priv->applications, app);502 priv->applications = g_list_remove(priv->applications, app);
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);
491504
492 if (app->icon_path != NULL) {505 if (app->icon_theme_path != NULL) {
493 theme_dir_unref(application, app->icon_path);506 theme_dir_unref(application, app->icon_theme_path);
494 g_free(app->icon_path);507 g_free(app->icon_theme_path);
495 }508 }
496 if (app->dbusaddress != NULL) {509 if (app->dbusaddress != NULL) {
497 g_free(app->dbusaddress);510 g_free(app->dbusaddress);
@@ -499,6 +512,9 @@
499 if (app->dbusobject != NULL) {512 if (app->dbusobject != NULL) {
500 g_free(app->dbusobject);513 g_free(app->dbusobject);
501 }514 }
515 if (app->icon_name != NULL) {
516 g_free(app->icon_name);
517 }
502 if (app->entry.image != NULL) {518 if (app->entry.image != NULL) {
503 g_object_unref(G_OBJECT(app->entry.image));519 g_object_unref(G_OBJECT(app->entry.image));
504 }520 }
@@ -533,6 +549,37 @@
533 gchar * longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX);549 gchar * longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX);
534 indicator_image_helper_update(app->entry.image, longname);550 indicator_image_helper_update(app->entry.image, longname);
535 g_free(longname);551 g_free(longname);
552
553 app->icon_name = g_strdup(iconname);
554
555 return;
556}
557
558/* The callback for the signal that the icon theme path for an application
559 has changed. */
560static void
561application_icon_theme_path_changed (DBusGProxy * proxy, gint position, const gchar * icon_theme_path, IndicatorApplication * application)
562{
563 IndicatorApplicationPrivate * priv = INDICATOR_APPLICATION_GET_PRIVATE(application);
564 ApplicationEntry * app = (ApplicationEntry *)g_list_nth_data(priv->applications, position);
565
566 if (app == NULL) {
567 g_warning("Unable to find application at position: %d", position);
568 return;
569 }
570
571 if (g_strcmp0(icon_theme_path, app->icon_theme_path) != 0) {
572 if(app->icon_theme_path != NULL) {
573 theme_dir_unref(application, app->icon_theme_path);
574 g_free(app->icon_theme_path);
575 app->icon_theme_path = NULL;
576 }
577 if (icon_theme_path != NULL && icon_theme_path[0] != '\0') {
578 app->icon_theme_path = g_strdup(icon_theme_path);
579 theme_dir_ref(application, app->icon_theme_path);
580 }
581 indicator_image_helper_update(app->entry.image, app->icon_name);
582 }
536583
537 return;584 return;
538}585}
@@ -564,13 +611,13 @@
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));
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));
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));
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));
568615
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);
570}617}
571618
572/* Refs a theme directory, and it may add it to the search619/* Unrefs a theme directory. This may involve removing it from
573 path */620 the search path. */
574static void621static void
575theme_dir_unref(IndicatorApplication * ia, const gchar * dir)622theme_dir_unref(IndicatorApplication * ia, const gchar * dir)
576{623{
@@ -629,8 +676,8 @@
629 return;676 return;
630}677}
631678
632/* Unrefs a theme directory. This may involve removing it from679/* Refs a theme directory, and it may add it to the search
633 the search path. */680 path */
634static void681static void
635theme_dir_ref(IndicatorApplication * ia, const gchar * dir)682theme_dir_ref(IndicatorApplication * ia, const gchar * dir)
636{683{
637684
=== modified file 'src/notification-item.xml'
--- src/notification-item.xml 2010-03-15 17:10:43 +0000
+++ src/notification-item.xml 2010-07-22 17:41:15 +0000
@@ -19,6 +19,8 @@
19<!-- Signals -->19<!-- Signals -->
20 <signal name="NewIcon">20 <signal name="NewIcon">
21 </signal>21 </signal>
22 <signal name="NewIconThemePath">
23 </signal>
22 <signal name="NewAttentionIcon">24 <signal name="NewAttentionIcon">
23 </signal>25 </signal>
24 <signal name="NewStatus">26 <signal name="NewStatus">

Subscribers

People subscribed via source and target branches