aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-application.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-01-08 14:37:48 -0600
committerTed Gould <ted@gould.cx>2010-01-08 14:37:48 -0600
commitd8cb0ba32a1cc4fd9a9f9f22e3c0c6ed9728f2f2 (patch)
treeb03665e65dff854de955ec13891791e61cf84746 /src/indicator-application.c
parenta5753822cc80f3f579aa61801b54134b3baa8076 (diff)
parent5f797d71ef38ddb421e9b26757df8d3e87b84bce (diff)
downloadlibayatana-appindicator-d8cb0ba32a1cc4fd9a9f9f22e3c0c6ed9728f2f2.tar.gz
libayatana-appindicator-d8cb0ba32a1cc4fd9a9f9f22e3c0c6ed9728f2f2.tar.bz2
libayatana-appindicator-d8cb0ba32a1cc4fd9a9f9f22e3c0c6ed9728f2f2.zip
Icons branch
Diffstat (limited to 'src/indicator-application.c')
-rw-r--r--src/indicator-application.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/indicator-application.c b/src/indicator-application.c
index fbfbd40..c330645 100644
--- a/src/indicator-application.c
+++ b/src/indicator-application.c
@@ -94,6 +94,7 @@ static GList * get_entries (IndicatorObject * io);
static void connected (IndicatorServiceManager * sm, gboolean connected, IndicatorApplication * application);
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 get_applications (DBusGProxy *proxy, GPtrArray *OUT_applications, GError *error, gpointer userdata);
G_DEFINE_TYPE (IndicatorApplication, indicator_application, INDICATOR_OBJECT_TYPE);
@@ -120,6 +121,11 @@ indicator_application_class_init (IndicatorApplicationClass *klass)
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_INVALID);
+ dbus_g_object_register_marshaller(_application_service_marshal_VOID__INT_STRING,
+ G_TYPE_NONE,
+ G_TYPE_INT,
+ G_TYPE_STRING,
+ G_TYPE_INVALID);
return;
}
@@ -219,6 +225,11 @@ connected (IndicatorServiceManager * sm, gboolean connected, IndicatorApplicatio
"ApplicationRemoved",
G_TYPE_INT,
G_TYPE_INVALID);
+ dbus_g_proxy_add_signal(priv->service_proxy,
+ "ApplicationIconChanged",
+ G_TYPE_INT,
+ G_TYPE_STRING,
+ G_TYPE_INVALID);
/* Connect to them */
g_debug("Connect to them.");
@@ -232,6 +243,11 @@ connected (IndicatorServiceManager * sm, gboolean connected, IndicatorApplicatio
G_CALLBACK(application_removed),
application,
NULL /* Disconnection Signal */);
+ dbus_g_proxy_connect_signal(priv->service_proxy,
+ "ApplicationIconChanged",
+ G_CALLBACK(application_icon_changed),
+ application,
+ NULL /* Disconnection Signal */);
/* Query it for existing applications */
g_debug("Request current apps");
@@ -330,6 +346,23 @@ application_removed (DBusGProxy * proxy, gint position, IndicatorApplication * a
return;
}
+/* The callback for the signal that the icon for an application
+ has changed. */
+static void
+application_icon_changed (DBusGProxy * proxy, gint position, const gchar * iconname, 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;
+ }
+
+ gtk_image_set_from_icon_name(app->entry.image, iconname, GTK_ICON_SIZE_MENU);
+ return;
+}
+
/* This repsonds to the list of applications that the service
has and calls application_added on each one of them. */
static void