diff options
author | Ted Gould <ted@gould.cx> | 2010-01-08 15:37:45 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-01-08 15:37:45 -0600 |
commit | 7a78594a6017f4c7aab921a778bb186759b5cded (patch) | |
tree | 71d883c4ac28e60235cb870f3961a6fcd28bed3d /src/indicator-application.c | |
parent | aaa7438bff492c735bffa378ef5d38d3452b4e6f (diff) | |
parent | c4b431a4070d84c12b56ba3007356d38006d89ec (diff) | |
download | libayatana-appindicator-7a78594a6017f4c7aab921a778bb186759b5cded.tar.gz libayatana-appindicator-7a78594a6017f4c7aab921a778bb186759b5cded.tar.bz2 libayatana-appindicator-7a78594a6017f4c7aab921a778bb186759b5cded.zip |
* Upstream merge:
* Adding support for icons changing through the service and
in the indicator.
* Fixing the generated headers for DBus Properties calls
* Fixing libappindicator set_icon to set the right icon.
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 |