aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-application.c
diff options
context:
space:
mode:
authorC10uD <c10ud.dev@gmail.com>2010-07-22 14:57:14 +0200
committerC10uD <c10ud.dev@gmail.com>2010-07-22 14:57:14 +0200
commit47806177db55300ada6d5f6bf543eb77d765f0f3 (patch)
treec0cc67fb94b590427c26f9d10451573802514a48 /src/indicator-application.c
parent17dea0907c51dfb39686f6840a9404467d79db82 (diff)
downloadayatana-indicator-application-47806177db55300ada6d5f6bf543eb77d765f0f3.tar.gz
ayatana-indicator-application-47806177db55300ada6d5f6bf543eb77d765f0f3.tar.bz2
ayatana-indicator-application-47806177db55300ada6d5f6bf543eb77d765f0f3.zip
trying to implement runtime theme-path changing
Diffstat (limited to 'src/indicator-application.c')
-rw-r--r--src/indicator-application.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/indicator-application.c b/src/indicator-application.c
index 16c3a9f..66913df 100644
--- a/src/indicator-application.c
+++ b/src/indicator-application.c
@@ -108,6 +108,7 @@ 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_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_path_changed (DBusGProxy * proxy, gint position, const gchar * iconpath, 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 +281,11 @@ connected (IndicatorApplication * application)
G_TYPE_INT,
G_TYPE_STRING,
G_TYPE_INVALID);
+ dbus_g_proxy_add_signal(priv->service_proxy,
+ "ApplicationIconPathChanged",
+ G_TYPE_INT,
+ G_TYPE_STRING,
+ G_TYPE_INVALID);
/* Connect to them */
g_debug("Connect to them.");
@@ -298,6 +304,11 @@ connected (IndicatorApplication * application)
G_CALLBACK(application_icon_changed),
application,
NULL /* Disconnection Signal */);
+ dbus_g_proxy_connect_signal(priv->service_proxy,
+ "ApplicationIconPathChanged",
+ G_CALLBACK(application_icon_path_changed),
+ application,
+ NULL /* Disconnection Signal */);
}
/* Query it for existing applications */
@@ -537,6 +548,29 @@ application_icon_changed (DBusGProxy * proxy, gint position, const gchar * iconn
return;
}
+/* The callback for the signal that the icon path for an application
+ has changed. */
+static void
+application_icon_path_changed (DBusGProxy * proxy, gint position, const gchar * iconpath, 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;
+ }
+
+ g_free(app->icon_path);
+ app->icon_path = NULL;
+ if (iconpath != NULL && iconpath[0] != '\0') {
+ app->icon_path = g_strdup(iconpath);
+ theme_dir_ref(application, iconpath);
+ }
+
+ return;
+}
+
/* This repsonds to the list of applications that the service
has and calls application_added on each one of them. */
static void