aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-08-05 16:54:12 -0500
committerTed Gould <ted@gould.cx>2010-08-05 16:54:12 -0500
commitc4045e9150fa79827d62d2ffb8c03d6d9b905a46 (patch)
treece9622c944e4ba9166f553d00ab25843c56be66f
parentc1aaada70bc0a55e99e1ef7e13e477ddf553f386 (diff)
parent9291697e3e6d4270a7f6200c0dc3d85743feb6d2 (diff)
downloadlibayatana-appindicator-c4045e9150fa79827d62d2ffb8c03d6d9b905a46.tar.gz
libayatana-appindicator-c4045e9150fa79827d62d2ffb8c03d6d9b905a46.tar.bz2
libayatana-appindicator-c4045e9150fa79827d62d2ffb8c03d6d9b905a46.zip
Syncing with trunk and resolving conflicts
-rw-r--r--bindings/mono/libappindicator-api.metadata6
-rw-r--r--bindings/python/appindicator.defs17
-rw-r--r--docs/reference/libappindicator-sections.txt3
-rw-r--r--src/app-indicator.c88
-rw-r--r--src/app-indicator.h27
-rw-r--r--src/application-service-appstore.c92
-rw-r--r--src/application-service-appstore.h1
-rw-r--r--src/application-service.xml5
-rw-r--r--src/indicator-application.c72
-rw-r--r--src/notification-item.xml3
10 files changed, 248 insertions, 66 deletions
diff --git a/bindings/mono/libappindicator-api.metadata b/bindings/mono/libappindicator-api.metadata
index 8f9df53..718c500 100644
--- a/bindings/mono/libappindicator-api.metadata
+++ b/bindings/mono/libappindicator-api.metadata
@@ -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>
diff --git a/bindings/python/appindicator.defs b/bindings/python/appindicator.defs
index 98abe4c..b6c7402 100644
--- a/bindings/python/appindicator.defs
+++ b/bindings/python/appindicator.defs
@@ -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")
diff --git a/docs/reference/libappindicator-sections.txt b/docs/reference/libappindicator-sections.txt
index 70df0b8..e0436ed 100644
--- a/docs/reference/libappindicator-sections.txt
+++ b/docs/reference/libappindicator-sections.txt
@@ -9,6 +9,7 @@ APP_INDICATOR_GET_CLASS
APP_INDICATOR_SIGNAL_NEW_ICON
APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON
APP_INDICATOR_SIGNAL_NEW_STATUS
+APP_INDICATOR_SIGNAL_NEW_ICON_THEME_PATH
APP_INDICATOR_SIGNAL_CONNECTION_CHANGED
AppIndicatorCategory
AppIndicatorStatus
@@ -23,10 +24,12 @@ app_indicator_set_status
app_indicator_set_attention_icon
app_indicator_set_menu
app_indicator_set_icon
+app_indicator_set_icon_theme_path
app_indicator_get_id
app_indicator_get_category
app_indicator_get_status
app_indicator_get_icon
+app_indicator_get_icon_theme_path
app_indicator_get_attention_icon
app_indicator_get_menu
</SECTION>
diff --git a/src/app-indicator.c b/src/app-indicator.c
index 32f512f..fdfcc23 100644
--- a/src/app-indicator.c
+++ b/src/app-indicator.c
@@ -69,7 +69,7 @@ struct _AppIndicatorPrivate {
AppIndicatorStatus status;
gchar *icon_name;
gchar *attention_icon_name;
- gchar * icon_path;
+ gchar *icon_theme_path;
DbusmenuServer *menuservice;
GtkWidget *menu;
@@ -88,6 +88,7 @@ enum {
NEW_ATTENTION_ICON,
NEW_STATUS,
CONNECTION_CHANGED,
+ NEW_ICON_THEME_PATH,
LAST_SIGNAL
};
@@ -229,7 +230,7 @@ app_indicator_class_init (AppIndicatorClass *klass)
"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 @@ app_indicator_class_init (AppIndicatorClass *klass)
"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 @@ app_indicator_class_init (AppIndicatorClass *klass)
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__STRING,
+ G_TYPE_NONE, 1, G_TYPE_STRING);
+
/* 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 @@ app_indicator_init (AppIndicator *self)
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 @@ app_indicator_finalize (GObject *object)
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 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu
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 @@ app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GPa
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 @@ app_indicator_new (const gchar *id,
@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 @@ AppIndicator *
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 @@ app_indicator_set_icon (AppIndicator *self, const gchar *icon_name)
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, g_strdup(self->priv->icon_theme_path));
+ }
+
+ return;
+}
+
static void
activate_menuitem (DbusmenuMenuitem *mi, guint timestamp, gpointer user_data)
{
@@ -1626,6 +1666,22 @@ app_indicator_get_icon (AppIndicator *self)
}
/**
+ 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
diff --git a/src/app-indicator.h b/src/app-indicator.h
index e37abd4..b17f023 100644
--- a/src/app-indicator.h
+++ b/src/app-indicator.h
@@ -69,6 +69,7 @@ G_BEGIN_DECLS
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 @@ G_BEGIN_DECLS
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,12 +154,12 @@ typedef struct _AppIndicatorPrivate AppIndicatorPrivate;
@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.
@unfallback: The function that gets called if an Application
Indicator area appears after the fallback has been created.
- @app_indicator_reserved_1: Reserved for future use.
@app_indicator_reserved_2: Reserved for future use.
The signals and external functions that make up the #AppIndicator
@@ -163,12 +170,12 @@ struct _AppIndicatorClass {
GObjectClass parent_class;
/* DBus Signals */
- void (* new_icon) (AppIndicator *indicator,
+ void (* new_icon) (AppIndicator *indicator,
gpointer user_data);
- void (* new_attention_icon) (AppIndicator *indicator,
+ void (* new_attention_icon) (AppIndicator *indicator,
gpointer user_data);
- void (* new_status) (AppIndicator *indicator,
- const gchar *status,
+ void (* new_status) (AppIndicator *indicator,
+ const gchar *status,
gpointer user_data);
/* Local Signals */
@@ -181,8 +188,11 @@ struct _AppIndicatorClass {
void (*unfallback) (AppIndicator * indicator,
GtkStatusIcon * status_icon);
+ void (* new_icon_theme_path) (AppIndicator *indicator,
+ const gchar *icon_theme_path,
+ gpointer user_data);
+
/* Reserved */
- void (*app_indicator_reserved_1)(void);
void (*app_indicator_reserved_2)(void);
};
@@ -215,7 +225,7 @@ AppIndicator *app_indicator_new (const gchar
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 @@ void app_indicator_set_menu (AppIndicator
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);
diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c
index 7f77a78..55906ff 100644
--- a/src/application-service-appstore.c
+++ b/src/application-service-appstore.c
@@ -38,20 +38,21 @@ static gboolean _application_service_server_get_applications (ApplicationService
#include "application-service-server.h"
-#define NOTIFICATION_ITEM_PROP_ID "Id"
-#define NOTIFICATION_ITEM_PROP_CATEGORY "Category"
-#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_MENU "Menu"
-#define NOTIFICATION_ITEM_PROP_LABEL "Label"
-#define NOTIFICATION_ITEM_PROP_LABEL_GUIDE "LabelGuide"
-
-#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_LABEL "NewLabel"
+#define NOTIFICATION_ITEM_PROP_ID "Id"
+#define NOTIFICATION_ITEM_PROP_CATEGORY "Category"
+#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_THEME_PATH "IconThemePath"
+#define NOTIFICATION_ITEM_PROP_MENU "Menu"
+#define NOTIFICATION_ITEM_PROP_LABEL "Label"
+#define NOTIFICATION_ITEM_PROP_LABEL_GUIDE "LabelGuide"
+
+#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_LABEL "NewLabel"
+#define NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH "NewIconThemePath"
/* Private Stuff */
struct _ApplicationServiceAppstorePrivate {
@@ -80,7 +81,7 @@ struct _Application {
gchar * icon;
gchar * aicon;
gchar * menu;
- gchar * icon_path;
+ gchar * icon_theme_path;
gchar * label;
gchar * guide;
gboolean currently_free;
@@ -95,6 +96,7 @@ enum {
APPLICATION_REMOVED,
APPLICATION_ICON_CHANGED,
APPLICATION_LABEL_CHANGED,
+ APPLICATION_ICON_THEME_PATH_CHANGED,
LAST_SIGNAL
};
@@ -144,6 +146,13 @@ application_service_appstore_class_init (ApplicationServiceAppstoreClass *klass)
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);
signals[APPLICATION_LABEL_CHANGED] = g_signal_new ("application-label-changed",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
@@ -265,11 +274,11 @@ get_all_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError * err
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("");
}
gpointer label_data = g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_LABEL);
@@ -379,8 +388,8 @@ application_free (Application * app)
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);
}
if (app->label != NULL) {
g_free(app->label);
@@ -484,7 +493,7 @@ apply_status (Application * app, AppIndicatorStatus status)
g_list_index(priv->applications, app), /* Position */
app->dbus_name,
app->menu,
- app->icon_path,
+ app->icon_theme_path,
app->label,
app->guide,
TRUE);
@@ -628,6 +637,32 @@ new_status (DBusGProxy * proxy, const gchar * status, gpointer data)
}
/* Called when the Notification Item signals that it
+ has a new icon theme path. */
+static void
+new_icon_theme_path (DBusGProxy * proxy, const gchar * icon_theme_path, gpointer data)
+{
+ Application * app = (Application *)data;
+ if (!app->validated) return;
+
+ if (g_strcmp0(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(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, app->icon_theme_path, TRUE);
+ }
+ }
+
+ return;
+}
+
+/* Called when the Notification Item signals that it
has a new label. */
static void
new_label (DBusGProxy * proxy, const gchar * label, const gchar * guide, gpointer data)
@@ -695,7 +730,7 @@ application_service_appstore_application_add (ApplicationServiceAppstore * appst
app->icon = NULL;
app->aicon = NULL;
app->menu = NULL;
- app->icon_path = NULL;
+ app->icon_theme_path = NULL;
app->label = NULL;
app->guide = NULL;
app->currently_free = FALSE;
@@ -744,6 +779,10 @@ application_service_appstore_application_add (ApplicationServiceAppstore * appst
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_STRING,
+ G_TYPE_INVALID);
dbus_g_proxy_add_signal(app->dbus_proxy,
NOTIFICATION_ITEM_SIG_NEW_LABEL,
G_TYPE_STRING,
@@ -765,6 +804,11 @@ application_service_appstore_application_add (ApplicationServiceAppstore * appst
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);
dbus_g_proxy_connect_signal(app->dbus_proxy,
NOTIFICATION_ITEM_SIG_NEW_LABEL,
G_CALLBACK(new_label),
@@ -860,7 +904,7 @@ _application_service_server_get_applications (ApplicationServiceAppstore * appst
/* Icon path */
g_value_init(&value, G_TYPE_STRING);
- g_value_set_string(&value, app->icon_path);
+ g_value_set_string(&value, app->icon_theme_path);
g_value_array_append(values, &value);
g_value_unset(&value);
diff --git a/src/application-service-appstore.h b/src/application-service-appstore.h
index 34c7b1c..9ae2874 100644
--- a/src/application-service-appstore.h
+++ b/src/application-service-appstore.h
@@ -46,6 +46,7 @@ struct _ApplicationServiceAppstoreClass {
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_theme_path_changed)(ApplicationServiceAppstore * appstore, gint, const gchar *, gpointer);
void (*application_label_changed)(ApplicationServiceAppstore * appstore, gint, const gchar *, const gchar *, gpointer);
};
diff --git a/src/application-service.xml b/src/application-service.xml
index df49516..031bf68 100644
--- a/src/application-service.xml
+++ b/src/application-service.xml
@@ -46,11 +46,14 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
<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>
<signal name="ApplicationLabelChanged">
<arg type="i" name="position" direction="out" />
<arg type="s" name="label" direction="out" />
<arg type="s" name="guide" direction="out" />
</signal>
-
</interface>
</node>
diff --git a/src/indicator-application.c b/src/indicator-application.c
index eb3de3c..36e1446 100644
--- a/src/indicator-application.c
+++ b/src/indicator-application.c
@@ -84,7 +84,7 @@ struct _IndicatorApplicationPrivate {
typedef struct _ApplicationEntry ApplicationEntry;
struct _ApplicationEntry {
IndicatorObjectEntry entry;
- gchar * icon_path;
+ gchar * icon_theme_path;
gboolean old_service;
gchar * dbusobject;
gchar * dbusaddress;
@@ -107,10 +107,11 @@ static void disconnected (IndicatorApplication * application);
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, const gchar * label, const gchar * guide, IndicatorApplication * application);
+static void application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, const gchar * label, const gchar * guide, IndicatorApplication * application);
static void application_removed (DBusGProxy * proxy, gint position , IndicatorApplication * application);
static void application_label_changed (DBusGProxy * proxy, gint position, const gchar * label, const gchar * guide, 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);
@@ -294,6 +295,11 @@ connected (IndicatorApplication * application)
G_TYPE_STRING,
G_TYPE_INVALID);
dbus_g_proxy_add_signal(priv->service_proxy,
+ "ApplicationIconThemePathChanged",
+ G_TYPE_INT,
+ G_TYPE_STRING,
+ G_TYPE_INVALID);
+ dbus_g_proxy_add_signal(priv->service_proxy,
"ApplicationLabelChanged",
G_TYPE_INT,
G_TYPE_STRING,
@@ -318,6 +324,11 @@ connected (IndicatorApplication * application)
application,
NULL /* Disconnection Signal */);
dbus_g_proxy_connect_signal(priv->service_proxy,
+ "ApplicationIconThemePathChanged",
+ G_CALLBACK(application_icon_theme_path_changed),
+ application,
+ NULL /* Disconnection Signal */);
+ dbus_g_proxy_connect_signal(priv->service_proxy,
"ApplicationLabelChanged",
G_CALLBACK(application_label_changed),
application,
@@ -477,7 +488,7 @@ guess_label_size (ApplicationEntry * app)
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, const gchar * label, const gchar * guide, IndicatorApplication * application)
+application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, const gchar * label, const gchar * guide, IndicatorApplication * application)
{
g_return_if_fail(IS_INDICATOR_APPLICATION(application));
g_debug("Building new application entry: %s with icon: %s", dbusaddress, iconname);
@@ -499,10 +510,10 @@ application_added (DBusGProxy * proxy, const gchar * iconname, gint position, co
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);
@@ -570,9 +581,9 @@ application_removed (DBusGProxy * proxy, gint position, IndicatorApplication * a
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);
@@ -711,6 +722,35 @@ application_icon_changed (DBusGProxy * proxy, gint position, const gchar * iconn
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->longname);
+ }
+
+ return;
+}
+
/* This repsonds to the list of applications that the service
has and calls application_added on each one of them. */
static void
@@ -738,15 +778,15 @@ get_applications_helper (gpointer data, gpointer user_data)
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));
const gchar * label = g_value_get_string(g_value_array_get_nth(array, 5));
const gchar * guide = g_value_get_string(g_value_array_get_nth(array, 6));
- return application_added(NULL, icon_name, position, dbus_address, dbus_object, icon_path, label, guide, user_data);
+ return application_added(NULL, icon_name, position, dbus_address, dbus_object, icon_theme_path, label, guide, 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)
{
@@ -805,8 +845,8 @@ theme_dir_unref(IndicatorApplication * ia, const gchar * dir)
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)
{
diff --git a/src/notification-item.xml b/src/notification-item.xml
index b339e7b..01261b5 100644
--- a/src/notification-item.xml
+++ b/src/notification-item.xml
@@ -21,6 +21,9 @@
<!-- Signals -->
<signal name="NewIcon">
</signal>
+ <signal name="NewIconThemePath">
+ <arg type="s" name="icon_theme_path" direction="out" />
+ </signal>
<signal name="NewAttentionIcon">
</signal>
<signal name="NewStatus">