diff options
author | Ted Gould <ted@gould.cx> | 2010-01-08 15:35:23 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-01-08 15:35:23 -0600 |
commit | 98237f0789319b6133411618d505a2c945e669a5 (patch) | |
tree | ab1abf5193e2cddec2e6df706506d5043919e133 /src/indicator-application.c | |
parent | a5753822cc80f3f579aa61801b54134b3baa8076 (diff) | |
parent | bb71fc2d4c0b555f23940b8c9d4f6973307cbd20 (diff) | |
download | libayatana-appindicator-98237f0789319b6133411618d505a2c945e669a5.tar.gz libayatana-appindicator-98237f0789319b6133411618d505a2c945e669a5.tar.bz2 libayatana-appindicator-98237f0789319b6133411618d505a2c945e669a5.zip |
Supporting icons changing and status changing.
Diffstat (limited to 'src/indicator-application.c')
-rw-r--r-- | src/indicator-application.c | 33 |
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 |