ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #01930
[Merge] lp:~c10ud/indicator-application/runtime-themepath-change into lp:indicator-application
Sense Hofstede has proposed merging lp:~c10ud/indicator-application/runtime-themepath-change into lp:indicator-application.
Requested reviews:
Indicator Applet Developers (indicator-applet-developers)
Related bugs:
#607831 change theme path while application is running
https://bugs.launchpad.net/bugs/607831
It works now and was tested by C10uD.
--
https://code.launchpad.net/~c10ud/indicator-application/runtime-themepath-change/+merge/30695
Your team ayatana-commits is subscribed to branch lp:indicator-application.
=== 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 @@
<attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='connection_changed']" name="cname">connection-changed</attr>
<attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_icon']" name="name">NewIcon</attr>
<attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_icon']" name="cname">new-icon</attr>
+ <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_icon_theme_path']" name="name">NewIconThemePath</attr>
+ <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_icon_theme_path']" name="cname">new-icon-theme-path</attr>
<attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_ID_S']" name="name">ID</attr>
<attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_CATEGORY_S']" name="hidden">true</attr>
<attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_STATUS_S']" name="hidden">true</attr>
@@ -26,16 +28,18 @@
<attr path="/api/namespace/object[@cname='AppIndicator']/constructor[@cname='app_indicator_new_with_path']/*/*[@name='id']" name="property_name">id</attr>
<attr path="/api/namespace/object[@cname='AppIndicator']/constructor[@cname='app_indicator_new_with_path']/*/*[@name='icon_name']" name="property_name">icon-name</attr>
<attr path="/api/namespace/object[@cname='AppIndicator']/constructor[@cname='app_indicator_new_with_path']/*/*[@name='category']" name="property_name">category</attr>
- <attr path="/api/namespace/object[@cname='AppIndicator']/constructor[@cname='app_indicator_new_with_path']/*/*[@name='icon_path']" name="property_name">icon-theme-path</attr>
+ <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>
<remove-node path="/api/namespace/object/method[@cname='app_indicator_get_id']" />
<remove-node path="/api/namespace/object/method[@cname='app_indicator_get_status']" />
<remove-node path="/api/namespace/object/method[@cname='app_indicator_get_icon']" />
+ <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_icon_theme_path']" />
<remove-node path="/api/namespace/object/method[@cname='app_indicator_get_category']" />
<remove-node path="/api/namespace/object/method[@cname='app_indicator_get_attention_icon']" />
<remove-node path="/api/namespace/object/method[@cname='app_indicator_set_id']" />
<remove-node path="/api/namespace/object/method[@cname='app_indicator_set_status']" />
<remove-node path="/api/namespace/object/method[@cname='app_indicator_set_icon']" />
+ <remove-node path="/api/namespace/object/method[@cname='app_indicator_set_icon_theme_path']" />
<remove-node path="/api/namespace/object/method[@cname='app_indicator_set_attention_icon']" />
</metadata>
=== 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 @@
'("const-gchar*" "id")
'("const-gchar*" "icon_name")
'("AppIndicatorCategory" "category")
- '("const-gchar*" "icon_path" (null-ok) (default "NULL"))
+ '("const-gchar*" "icon_theme_path" (null-ok) (default "NULL"))
)
)
@@ -89,6 +89,15 @@
)
)
+(define-method set_icon_theme_path
+ (of-object "AppIndicator")
+ (c-name "app_indicator_set_icon_theme_path")
+ (return-type "none")
+ (parameters
+ '("const-gchar*" "icon_theme_path" (null-ok))
+ )
+)
+
(define-method get_id
(of-object "AppIndicator")
(c-name "app_indicator_get_id")
@@ -113,6 +122,12 @@
(return-type "const-gchar*")
)
+(define-method get_icon_theme_path
+ (of-object "AppIndicator")
+ (c-name "app_indicator_get_icon_theme_path")
+ (return-type "const-gchar*")
+)
+
(define-method get_attention_icon
(of-object "AppIndicator")
(c-name "app_indicator_get_attention_icon")
=== 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 @@
AppIndicatorStatus status;
gchar *icon_name;
gchar *attention_icon_name;
- gchar * icon_path;
+ gchar *icon_theme_path;
DbusmenuServer *menuservice;
GtkWidget *menu;
@@ -88,6 +88,7 @@
NEW_ATTENTION_ICON,
NEW_STATUS,
CONNECTION_CHANGED,
+ NEW_ICON_THEME_PATH,
LAST_SIGNAL
};
@@ -229,7 +230,7 @@
"An icon for the indicator",
"The default icon that is shown for the indicator.",
NULL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT));
/**
AppIndicator:attention-icon-name:
@@ -256,7 +257,7 @@
"An additional path for custom icons.",
"An additional place to look for icon names that may be installed by the application.",
NULL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT));
/**
AppIndicator:menu:
@@ -347,6 +348,21 @@
g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE, 1, G_TYPE_BOOLEAN, G_TYPE_NONE);
+ /**
+ AppIndicator::new-icon-theme-path:
+ @arg0: The #AppIndicator object
+
+ Signaled when there is a new icon set for the
+ object.
+ */
+ signals[NEW_ICON_THEME_PATH] = g_signal_new (APP_INDICATOR_SIGNAL_NEW_ICON_THEME_PATH,
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (AppIndicatorClass, new_icon_theme_path),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0, G_TYPE_NONE);
+
/* Initialize the object as a DBus type */
dbus_g_object_type_install_info(APP_INDICATOR_TYPE,
&dbus_glib__notification_item_server_object_info);
@@ -365,7 +381,7 @@
priv->status = APP_INDICATOR_STATUS_PASSIVE;
priv->icon_name = NULL;
priv->attention_icon_name = NULL;
- priv->icon_path = NULL;
+ priv->icon_theme_path = NULL;
priv->menu = NULL;
priv->menuservice = NULL;
@@ -487,9 +503,9 @@
priv->attention_icon_name = NULL;
}
- if (priv->icon_path != NULL) {
- g_free(priv->icon_path);
- priv->icon_path = NULL;
+ if (priv->icon_theme_path != NULL) {
+ g_free(priv->icon_theme_path);
+ priv->icon_theme_path = NULL;
}
G_OBJECT_CLASS (app_indicator_parent_class)->finalize (object);
@@ -557,10 +573,9 @@
break;
case PROP_ICON_THEME_PATH:
- if (priv->icon_path != NULL) {
- g_free(priv->icon_path);
- }
- priv->icon_path = g_value_dup_string(value);
+ app_indicator_set_icon_theme_path (APP_INDICATOR (object),
+ g_value_get_string (value));
+ check_connect (self);
break;
default:
@@ -603,7 +618,7 @@
break;
case PROP_ICON_THEME_PATH:
- g_value_set_string (value, priv->icon_path);
+ g_value_set_string (value, priv->icon_theme_path);
break;
case PROP_MENU:
@@ -1025,12 +1040,12 @@
@id: The unique id of the indicator to create.
@icon_name: The icon name for this indicator
@category: The category of indicator.
- @icon_path: A custom path for finding icons.
+ @icon_theme_path: A custom path for finding icons.
Creates a new #AppIndicator setting the properties:
#AppIndicator:id with @id, #AppIndicator:category
with @category, #AppIndicator:icon-name with
- @icon_name and #AppIndicator:icon-theme-path with @icon_path.
+ @icon_name and #AppIndicator:icon-theme-path with @icon_theme_path.
Return value: A pointer to a new #AppIndicator object.
*/
@@ -1038,13 +1053,13 @@
app_indicator_new_with_path (const gchar *id,
const gchar *icon_name,
AppIndicatorCategory category,
- const gchar *icon_path)
+ const gchar *icon_theme_path)
{
AppIndicator *indicator = g_object_new (APP_INDICATOR_TYPE,
PROP_ID_S, id,
PROP_CATEGORY_S, category_from_enum (category),
PROP_ICON_NAME_S, icon_name,
- PROP_ICON_THEME_PATH_S, icon_path,
+ PROP_ICON_THEME_PATH_S, icon_theme_path,
NULL);
return indicator;
@@ -1134,6 +1149,31 @@
return;
}
+/**
+ app_indicator_set_icon_theme_path:
+ @self: The #AppIndicator object to use
+ @icon_theme_path: The icon theme path to set.
+
+ Sets the path to use when searching for icons.
+**/
+void
+app_indicator_set_icon_theme_path (AppIndicator *self, const gchar *icon_theme_path)
+{
+ g_return_if_fail (IS_APP_INDICATOR (self));
+
+ if (g_strcmp0 (self->priv->icon_theme_path, icon_theme_path) != 0)
+ {
+ if (self->priv->icon_theme_path != NULL)
+ g_free(self->priv->icon_theme_path);
+
+ self->priv->icon_theme_path = g_strdup(icon_theme_path);
+
+ g_signal_emit (self, signals[NEW_ICON_THEME_PATH], 0, TRUE);
+ }
+
+ return;
+}
+
static void
activate_menuitem (DbusmenuMenuitem *mi, guint timestamp, gpointer user_data)
{
@@ -1626,6 +1666,22 @@
}
/**
+ app_indicator_get_icon_theme_path:
+ @self: The #AppIndicator object to use
+
+ Wrapper function for property #AppIndicator:icon-theme-path.
+
+ Return value: The current icon theme path.
+*/
+const gchar *
+app_indicator_get_icon_theme_path (AppIndicator *self)
+{
+ g_return_val_if_fail (IS_APP_INDICATOR (self), NULL);
+
+ return self->priv->icon_theme_path;
+}
+
+/**
app_indicator_get_attention_icon:
@self: The #AppIndicator object to use
=== 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 @@
Gets a pointer to the #AppIndicatorClass for the object @obj.
*/
+
#define APP_INDICATOR_TYPE (app_indicator_get_type ())
#define APP_INDICATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APP_INDICATOR_TYPE, AppIndicator))
#define APP_INDICATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), APP_INDICATOR_TYPE, AppIndicatorClass))
@@ -96,10 +97,16 @@
String identifier for the #AppIndicator::connection-changed signal.
*/
+/**
+ APP_INDICATOR_SIGNAL_NEW_ICON_THEME_PATH:
+
+ String identifier for the #AppIndicator::new-icon-theme-path signal.
+*/
#define APP_INDICATOR_SIGNAL_NEW_ICON "new-icon"
#define APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON "new-attention-icon"
#define APP_INDICATOR_SIGNAL_NEW_STATUS "new-status"
#define APP_INDICATOR_SIGNAL_CONNECTION_CHANGED "connection-changed"
+#define APP_INDICATOR_SIGNAL_NEW_ICON_THEME_PATH "new-icon-theme-path"
/**
AppIndicatorCategory:
@@ -147,6 +154,7 @@
@new_icon: Slot for #AppIndicator::new-icon.
@new_attention_icon: Slot for #AppIndicator::new-attention-icon.
@new_status: Slot for #AppIndicator::new-status.
+ @new_icon_theme_path: Slot for #AppIndicator::new-icon-theme-path
@connection_changed: Slot for #AppIndicator::connection-changed.
@fallback: Function that gets called to make a #GtkStatusIcon when
there is no Application Indicator area available.
@@ -170,6 +178,8 @@
void (* new_status) (AppIndicator *indicator,
const gchar *status,
gpointer user_data);
+ void (* new_icon_theme_path) (AppIndicator *indicator,
+ gpointer user_data);
/* Local Signals */
void (* connection_changed) (AppIndicator * indicator,
@@ -215,7 +225,7 @@
AppIndicator *app_indicator_new_with_path (const gchar *id,
const gchar *icon_name,
AppIndicatorCategory category,
- const gchar *icon_path);
+ const gchar *icon_theme_path);
/* Set properties */
void app_indicator_set_status (AppIndicator *self,
@@ -226,12 +236,15 @@
GtkMenu *menu);
void app_indicator_set_icon (AppIndicator *self,
const gchar *icon_name);
+void app_indicator_set_icon_theme_path(AppIndicator *self,
+ const gchar *icon_theme_path);
/* Get properties */
const gchar * app_indicator_get_id (AppIndicator *self);
AppIndicatorCategory app_indicator_get_category (AppIndicator *self);
AppIndicatorStatus app_indicator_get_status (AppIndicator *self);
const gchar * app_indicator_get_icon (AppIndicator *self);
+const gchar * app_indicator_get_icon_theme_path(AppIndicator *self);
const gchar * app_indicator_get_attention_icon (AppIndicator *self);
GtkMenu * app_indicator_get_menu (AppIndicator *self);
=== 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 @@
#define NOTIFICATION_ITEM_PROP_STATUS "Status"
#define NOTIFICATION_ITEM_PROP_ICON_NAME "IconName"
#define NOTIFICATION_ITEM_PROP_AICON_NAME "AttentionIconName"
-#define NOTIFICATION_ITEM_PROP_ICON_PATH "IconThemePath"
+#define NOTIFICATION_ITEM_PROP_ICON_THEME_PATH "IconThemePath"
#define NOTIFICATION_ITEM_PROP_MENU "Menu"
#define NOTIFICATION_ITEM_SIG_NEW_ICON "NewIcon"
#define NOTIFICATION_ITEM_SIG_NEW_AICON "NewAttentionIcon"
#define NOTIFICATION_ITEM_SIG_NEW_STATUS "NewStatus"
+#define NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH "NewIconThemePath"
/* Private Stuff */
struct _ApplicationServiceAppstorePrivate {
@@ -77,7 +78,7 @@
gchar * icon;
gchar * aicon;
gchar * menu;
- gchar * icon_path;
+ gchar * icon_theme_path;
gboolean currently_free;
};
@@ -89,6 +90,7 @@
APPLICATION_ADDED,
APPLICATION_REMOVED,
APPLICATION_ICON_CHANGED,
+ APPLICATION_ICON_THEME_PATH_CHANGED,
LAST_SIGNAL
};
@@ -138,6 +140,13 @@
NULL, NULL,
_application_service_marshal_VOID__INT_STRING,
G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_STRING, G_TYPE_NONE);
+ signals[APPLICATION_ICON_THEME_PATH_CHANGED] = g_signal_new ("application-icon-theme-path-changed",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ApplicationServiceAppstoreClass, application_icon_theme_path_changed),
+ NULL, NULL,
+ _application_service_marshal_VOID__INT_STRING,
+ G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_STRING, G_TYPE_NONE);
dbus_g_object_type_install_info(APPLICATION_SERVICE_APPSTORE_TYPE,
&dbus_glib__application_service_server_object_info);
@@ -246,11 +255,11 @@
app->aicon = g_value_dup_string(g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_AICON_NAME));
}
- gpointer icon_path_data = g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_ICON_PATH);
- if (icon_path_data != NULL) {
- app->icon_path = g_value_dup_string((GValue *)icon_path_data);
+ gpointer icon_theme_path_data = g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_ICON_THEME_PATH);
+ if (icon_theme_path_data != NULL) {
+ app->icon_theme_path = g_value_dup_string((GValue *)icon_theme_path_data);
} else {
- app->icon_path = g_strdup("");
+ app->icon_theme_path = g_strdup("");
}
/* TODO: Calling approvers, but we're ignoring the results. So, eh. */
@@ -346,8 +355,8 @@
if (app->menu != NULL) {
g_free(app->menu);
}
- if (app->icon_path != NULL) {
- g_free(app->icon_path);
+ if (app->icon_theme_path != NULL) {
+ g_free(app->icon_theme_path);
}
g_free(app);
@@ -445,7 +454,7 @@
g_list_index(priv->applications, app), /* Position */
app->dbus_name,
app->menu,
- app->icon_path,
+ app->icon_theme_path,
TRUE);
}
} else {
@@ -540,6 +549,40 @@
return;
}
+/* Gets the data back on an updated icon theme path.
+ Maybe a new icon */
+static void
+new_icon_theme_path_cb (DBusGProxy * proxy, GValue value, GError * error, gpointer userdata)
+{
+ /* Check for errors */
+ if (error != NULL) {
+ g_warning("Unable to get updated icon theme path: %s", error->message);
+ return;
+ }
+
+ /* Grab the icon and make sure we have one */
+ const gchar * new_icon_theme_path = g_value_get_string(&value);
+
+ Application * app = (Application *) userdata;
+
+ if (g_strcmp0(new_icon_theme_path, app->icon_theme_path)) {
+ /* If the new icon theme path is actually a new icon theme path */
+ if (app->icon_theme_path != NULL) g_free(app->icon_theme_path);
+ app->icon_theme_path = g_strdup(new_icon_theme_path);
+
+ if (app->status == APP_INDICATOR_STATUS_ACTIVE) {
+ gint position = get_position(app);
+ if (position == -1) return;
+
+ g_signal_emit(G_OBJECT(app->appstore),
+ signals[APPLICATION_ICON_THEME_PATH_CHANGED], 0,
+ position, new_icon_theme_path, TRUE);
+ }
+ }
+
+ return;
+}
+
/* Called when the Notification Item signals that it
has a new icon. */
static void
@@ -586,6 +629,22 @@
return;
}
+/* Called when the Notification Item signals that it
+ has a new icon theme path. */
+static void
+new_icon_theme_path (DBusGProxy * proxy, gpointer data)
+{
+ Application * app = (Application *)data;
+ if (!app->validated) return;
+
+ org_freedesktop_DBus_Properties_get_async(app->prop_proxy,
+ NOTIFICATION_ITEM_DBUS_IFACE,
+ NOTIFICATION_ITEM_PROP_ICON_THEME_PATH,
+ new_icon_theme_path_cb,
+ app);
+ return;
+}
+
/* Adding a new NotificationItem object from DBus in to the
appstore. First, we need to get the information on it
though. */
@@ -612,7 +671,7 @@
app->icon = NULL;
app->aicon = NULL;
app->menu = NULL;
- app->icon_path = NULL;
+ app->icon_theme_path = NULL;
app->currently_free = FALSE;
/* Get the DBus proxy for the NotificationItem interface */
@@ -659,7 +718,10 @@
NOTIFICATION_ITEM_SIG_NEW_STATUS,
G_TYPE_STRING,
G_TYPE_INVALID);
-
+ dbus_g_proxy_add_signal(app->dbus_proxy,
+ NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH,
+ G_TYPE_INVALID);
+
dbus_g_proxy_connect_signal(app->dbus_proxy,
NOTIFICATION_ITEM_SIG_NEW_ICON,
G_CALLBACK(new_icon),
@@ -675,7 +737,12 @@
G_CALLBACK(new_status),
app,
NULL);
-
+ dbus_g_proxy_connect_signal(app->dbus_proxy,
+ NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH,
+ G_CALLBACK(new_icon_theme_path),
+ app,
+ NULL);
+
/* Get all the propertiees */
org_freedesktop_DBus_Properties_get_all_async(app->prop_proxy,
NOTIFICATION_ITEM_DBUS_IFACE,
@@ -764,7 +831,7 @@
/* Icon path */
g_value_init(&value, G_TYPE_STRING);
- g_value_set_string(&value, ((Application *)listpntr->data)->icon_path);
+ g_value_set_string(&value, ((Application *)listpntr->data)->icon_theme_path);
g_value_array_append(values, &value);
g_value_unset(&value);
=== 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 @@
void (*application_added) (ApplicationServiceAppstore * appstore, gchar *, gint, gchar *, gchar *, gpointer);
void (*application_removed) (ApplicationServiceAppstore * appstore, gint, gpointer);
- void (*application_icon_changed)(ApplicationServiceAppstore * appstore, gint, const gchar *, gpointer);
+ void (*application_icon_changed)(ApplicationServiceAppstore * appstore, gint, const gchar *, gpointer);
+ void (*application_icon_theme_path_changed)(ApplicationServiceAppstore * appstore, gint, const gchar *, gpointer);
};
struct _ApplicationServiceAppstore {
=== 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 @@
<arg type="i" name="position" direction="out" />
<arg type="s" name="icon_name" direction="out" />
</signal>
+ <signal name="ApplicationIconThemePathChanged">
+ <arg type="i" name="position" direction="out" />
+ <arg type="s" name="icon_theme_path" direction="out" />
+ </signal>
</interface>
</node>
=== 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 @@
typedef struct _ApplicationEntry ApplicationEntry;
struct _ApplicationEntry {
IndicatorObjectEntry entry;
- gchar * icon_path;
+ gchar * icon_theme_path;
+ gchar * icon_name;
gboolean old_service;
gchar * dbusobject;
gchar * dbusaddress;
@@ -105,9 +106,10 @@
static void disconnected_helper (gpointer data, gpointer user_data);
static gboolean disconnected_kill (gpointer user_data);
static void disconnected_kill_helper (gpointer data, gpointer user_data);
-static void application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_path, IndicatorApplication * application);
+static void application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, IndicatorApplication * application);
static void application_removed (DBusGProxy * proxy, gint position , IndicatorApplication * application);
static void application_icon_changed (DBusGProxy * proxy, gint position, const gchar * iconname, IndicatorApplication * application);
+static void application_icon_theme_path_changed (DBusGProxy * proxy, gint position, const gchar * icon_theme_path, IndicatorApplication * application);
static void get_applications (DBusGProxy *proxy, GPtrArray *OUT_applications, GError *error, gpointer userdata);
static void get_applications_helper (gpointer data, gpointer user_data);
static void theme_dir_unref(IndicatorApplication * ia, const gchar * dir);
@@ -280,6 +282,11 @@
G_TYPE_INT,
G_TYPE_STRING,
G_TYPE_INVALID);
+ dbus_g_proxy_add_signal(priv->service_proxy,
+ "ApplicationIconThemePathChanged",
+ G_TYPE_INT,
+ G_TYPE_STRING,
+ G_TYPE_INVALID);
/* Connect to them */
g_debug("Connect to them.");
@@ -298,6 +305,11 @@
G_CALLBACK(application_icon_changed),
application,
NULL /* Disconnection Signal */);
+ dbus_g_proxy_connect_signal(priv->service_proxy,
+ "ApplicationIconThemePathChanged",
+ G_CALLBACK(application_icon_theme_path_changed),
+ application,
+ NULL /* Disconnection Signal */);
}
/* Query it for existing applications */
@@ -413,7 +425,7 @@
ApplicationEntry and signaling the indicator host that
we've got a new indicator. */
static void
-application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_path, IndicatorApplication * application)
+application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, IndicatorApplication * application)
{
g_return_if_fail(IS_INDICATOR_APPLICATION(application));
g_debug("Building new application entry: %s with icon: %s", dbusaddress, iconname);
@@ -435,15 +447,16 @@
ApplicationEntry * app = g_new(ApplicationEntry, 1);
app->old_service = FALSE;
- app->icon_path = NULL;
- if (icon_path != NULL && icon_path[0] != '\0') {
- app->icon_path = g_strdup(icon_path);
- theme_dir_ref(application, icon_path);
+ app->icon_theme_path = NULL;
+ if (icon_theme_path != NULL && icon_theme_path[0] != '\0') {
+ app->icon_theme_path = g_strdup(icon_theme_path);
+ theme_dir_ref(application, icon_theme_path);
}
app->dbusaddress = g_strdup(dbusaddress);
app->dbusobject = g_strdup(dbusobject);
+ app->icon_name = g_strdup(iconname);
/* We make a long name using the suffix, and if that
icon is available we want to use it. Otherwise we'll
just use the name we were given. */
@@ -489,9 +502,9 @@
priv->applications = g_list_remove(priv->applications, app);
g_signal_emit(G_OBJECT(application), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED_ID, 0, &(app->entry), TRUE);
- if (app->icon_path != NULL) {
- theme_dir_unref(application, app->icon_path);
- g_free(app->icon_path);
+ if (app->icon_theme_path != NULL) {
+ theme_dir_unref(application, app->icon_theme_path);
+ g_free(app->icon_theme_path);
}
if (app->dbusaddress != NULL) {
g_free(app->dbusaddress);
@@ -499,6 +512,9 @@
if (app->dbusobject != NULL) {
g_free(app->dbusobject);
}
+ if (app->icon_name != NULL) {
+ g_free(app->icon_name);
+ }
if (app->entry.image != NULL) {
g_object_unref(G_OBJECT(app->entry.image));
}
@@ -533,6 +549,37 @@
gchar * longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX);
indicator_image_helper_update(app->entry.image, longname);
g_free(longname);
+
+ app->icon_name = g_strdup(iconname);
+
+ return;
+}
+
+/* The callback for the signal that the icon theme path for an application
+ has changed. */
+static void
+application_icon_theme_path_changed (DBusGProxy * proxy, gint position, const gchar * icon_theme_path, IndicatorApplication * application)
+{
+ IndicatorApplicationPrivate * priv = INDICATOR_APPLICATION_GET_PRIVATE(application);
+ ApplicationEntry * app = (ApplicationEntry *)g_list_nth_data(priv->applications, position);
+
+ if (app == NULL) {
+ g_warning("Unable to find application at position: %d", position);
+ return;
+ }
+
+ if (g_strcmp0(icon_theme_path, app->icon_theme_path) != 0) {
+ if(app->icon_theme_path != NULL) {
+ theme_dir_unref(application, app->icon_theme_path);
+ g_free(app->icon_theme_path);
+ app->icon_theme_path = NULL;
+ }
+ if (icon_theme_path != NULL && icon_theme_path[0] != '\0') {
+ app->icon_theme_path = g_strdup(icon_theme_path);
+ theme_dir_ref(application, app->icon_theme_path);
+ }
+ indicator_image_helper_update(app->entry.image, app->icon_name);
+ }
return;
}
@@ -564,13 +611,13 @@
gint position = g_value_get_int(g_value_array_get_nth(array, 1));
const gchar * dbus_address = g_value_get_string(g_value_array_get_nth(array, 2));
const gchar * dbus_object = g_value_get_boxed(g_value_array_get_nth(array, 3));
- const gchar * icon_path = g_value_get_string(g_value_array_get_nth(array, 4));
+ const gchar * icon_theme_path = g_value_get_string(g_value_array_get_nth(array, 4));
- return application_added(NULL, icon_name, position, dbus_address, dbus_object, icon_path, user_data);
+ return application_added(NULL, icon_name, position, dbus_address, dbus_object, icon_theme_path, user_data);
}
-/* Refs a theme directory, and it may add it to the search
- path */
+/* Unrefs a theme directory. This may involve removing it from
+ the search path. */
static void
theme_dir_unref(IndicatorApplication * ia, const gchar * dir)
{
@@ -629,8 +676,8 @@
return;
}
-/* Unrefs a theme directory. This may involve removing it from
- the search path. */
+/* Refs a theme directory, and it may add it to the search
+ path */
static void
theme_dir_ref(IndicatorApplication * ia, const gchar * dir)
{
=== 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 @@
<!-- Signals -->
<signal name="NewIcon">
</signal>
+ <signal name="NewIconThemePath">
+ </signal>
<signal name="NewAttentionIcon">
</signal>
<signal name="NewStatus">
Follow ups