aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-application.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/indicator-application.c')
-rw-r--r--src/indicator-application.c72
1 files changed, 56 insertions, 16 deletions
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)
{