diff options
author | Ted Gould <ted@gould.cx> | 2010-01-07 14:07:16 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-01-07 14:07:16 -0600 |
commit | 655f6d113305163d87643f9282f09b96fe5ccbe5 (patch) | |
tree | 914482eb2c67575b7385284000bffbc7ac3c383e /src | |
parent | 2c767da806cf8919a9ef1a827235f746f9693292 (diff) | |
download | ayatana-indicator-application-655f6d113305163d87643f9282f09b96fe5ccbe5.tar.gz ayatana-indicator-application-655f6d113305163d87643f9282f09b96fe5ccbe5.tar.bz2 ayatana-indicator-application-655f6d113305163d87643f9282f09b96fe5ccbe5.zip |
Responding to the icon changed signal in the indicator.
Diffstat (limited to 'src')
-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 f3566e4..221be04 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -93,6 +93,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, 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); @@ -118,6 +119,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; } @@ -216,6 +222,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."); @@ -229,6 +240,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"); @@ -317,6 +333,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 |