aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSense Egbert Hofstede <sense@ubuntu.com>2010-08-05 15:51:53 +0200
committerSense Egbert Hofstede <sense@ubuntu.com>2010-08-05 15:51:53 +0200
commit247e5a1ac3f714f831bea27fa87170b0ac7fec64 (patch)
tree0d809ef9c73ef069fa7c43f83c202603c8edf80a
parent0a8c09e4f8ce284788845f465dcc826a67602cd0 (diff)
downloadayatana-indicator-application-247e5a1ac3f714f831bea27fa87170b0ac7fec64.tar.gz
ayatana-indicator-application-247e5a1ac3f714f831bea27fa87170b0ac7fec64.tar.bz2
ayatana-indicator-application-247e5a1ac3f714f831bea27fa87170b0ac7fec64.zip
Passing the updated icon theme path along with the DBus signal, saving a DBus call.
-rw-r--r--src/app-indicator.c6
-rw-r--r--src/app-indicator.h11
-rw-r--r--src/application-service-appstore.c57
-rw-r--r--src/notification-item.xml1
4 files changed, 27 insertions, 48 deletions
diff --git a/src/app-indicator.c b/src/app-indicator.c
index 7b74495..fdfcc23 100644
--- a/src/app-indicator.c
+++ b/src/app-indicator.c
@@ -360,8 +360,8 @@ app_indicator_class_init (AppIndicatorClass *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);
+ 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,
@@ -1168,7 +1168,7 @@ app_indicator_set_icon_theme_path (AppIndicator *self, const gchar *icon_theme_p
self->priv->icon_theme_path = g_strdup(icon_theme_path);
- g_signal_emit (self, signals[NEW_ICON_THEME_PATH], 0, TRUE);
+ g_signal_emit (self, signals[NEW_ICON_THEME_PATH], 0, g_strdup(self->priv->icon_theme_path));
}
return;
diff --git a/src/app-indicator.h b/src/app-indicator.h
index 3a17ba1..31b7a4a 100644
--- a/src/app-indicator.h
+++ b/src/app-indicator.h
@@ -171,14 +171,15 @@ 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);
- void (* new_icon_theme_path) (AppIndicator *indicator,
+ void (* new_icon_theme_path) (AppIndicator *indicator,
+ const gchar *icon_theme_path,
gpointer user_data);
/* Local Signals */
diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c
index c5997e9..f18a89e 100644
--- a/src/application-service-appstore.c
+++ b/src/application-service-appstore.c
@@ -549,40 +549,6 @@ new_aicon_cb (DBusGProxy * proxy, GValue value, GError * error, gpointer userdat
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
@@ -632,16 +598,26 @@ 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, gpointer data)
+new_icon_theme_path (DBusGProxy * proxy, const gchar * icon_theme_path, 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);
+ 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;
}
@@ -720,6 +696,7 @@ application_service_appstore_application_add (ApplicationServiceAppstore * appst
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_connect_signal(app->dbus_proxy,
diff --git a/src/notification-item.xml b/src/notification-item.xml
index b25eb74..dc755c9 100644
--- a/src/notification-item.xml
+++ b/src/notification-item.xml
@@ -20,6 +20,7 @@
<signal name="NewIcon">
</signal>
<signal name="NewIconThemePath">
+ <arg type="s" name="icon_theme_path" direction="out" />
</signal>
<signal name="NewAttentionIcon">
</signal>