From 9185eeee48ad6fc91b023127e9f92f7348a0c6aa Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sun, 20 Dec 2009 17:24:13 -0600 Subject: Adding in the icon path to the list of parameters that are passed when we have a new application. --- src/indicator-application.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/indicator-application.c') diff --git a/src/indicator-application.c b/src/indicator-application.c index f3566e4..436a743 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -91,7 +91,7 @@ static void indicator_application_dispose (GObject *object); static void indicator_application_finalize (GObject *object); 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_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 get_applications (DBusGProxy *proxy, GPtrArray *OUT_applications, GError *error, gpointer userdata); @@ -111,12 +111,13 @@ indicator_application_class_init (IndicatorApplicationClass *klass) io_class->get_entries = get_entries; - dbus_g_object_register_marshaller(_application_service_marshal_VOID__STRING_INT_STRING_STRING, + dbus_g_object_register_marshaller(_application_service_marshal_VOID__STRING_INT_STRING_STRING_STRING, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_STRING, G_TYPE_INVALID); return; @@ -211,6 +212,7 @@ connected (IndicatorServiceManager * sm, gboolean connected, IndicatorApplicatio G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_STRING, G_TYPE_INVALID); dbus_g_proxy_add_signal(priv->service_proxy, "ApplicationRemoved", @@ -267,7 +269,7 @@ get_entries (IndicatorObject * io) 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, IndicatorApplication * application) +application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_path, IndicatorApplication * application) { g_debug("Building new application entry: %s with icon: %s", dbusaddress, iconname); IndicatorApplicationPrivate * priv = INDICATOR_APPLICATION_GET_PRIVATE(application); -- cgit v1.2.3 From 3915de95c9d64765cae653d02d124ca82127235e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sun, 20 Dec 2009 17:28:02 -0600 Subject: Adding the icon path to the app entry struct --- src/indicator-application.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/indicator-application.c') diff --git a/src/indicator-application.c b/src/indicator-application.c index 436a743..02c13c8 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -80,6 +80,7 @@ struct _IndicatorApplicationPrivate { typedef struct _ApplicationEntry ApplicationEntry; struct _ApplicationEntry { IndicatorObjectEntry entry; + gchar * icon_path; }; #define INDICATOR_APPLICATION_GET_PRIVATE(o) \ @@ -275,6 +276,7 @@ application_added (DBusGProxy * proxy, const gchar * iconname, gint position, co IndicatorApplicationPrivate * priv = INDICATOR_APPLICATION_GET_PRIVATE(application); ApplicationEntry * app = g_new(ApplicationEntry, 1); + app->icon_path = g_strdup(icon_path); app->entry.image = GTK_IMAGE(gtk_image_new_from_icon_name(iconname, GTK_ICON_SIZE_MENU)); app->entry.label = NULL; app->entry.menu = GTK_MENU(dbusmenu_gtkmenu_new((gchar *)dbusaddress, (gchar *)dbusobject)); @@ -304,6 +306,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) { + g_free(app->icon_path); + } if (app->entry.image != NULL) { g_object_unref(G_OBJECT(app->entry.image)); } -- cgit v1.2.3 From cd57997811b56c369eb3891ff0d92bc0cf503133 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sun, 20 Dec 2009 22:16:01 -0600 Subject: Appending the new icon path to the theme search. --- src/indicator-application.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/indicator-application.c') diff --git a/src/indicator-application.c b/src/indicator-application.c index 02c13c8..e07386a 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -276,7 +276,12 @@ application_added (DBusGProxy * proxy, const gchar * iconname, gint position, co IndicatorApplicationPrivate * priv = INDICATOR_APPLICATION_GET_PRIVATE(application); ApplicationEntry * app = g_new(ApplicationEntry, 1); - app->icon_path = g_strdup(icon_path); + app->icon_path = NULL; + if (icon_path != NULL && icon_path[0] != '\0') { + app->icon_path = g_strdup(icon_path); + gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), app->icon_path); + } + app->entry.image = GTK_IMAGE(gtk_image_new_from_icon_name(iconname, GTK_ICON_SIZE_MENU)); app->entry.label = NULL; app->entry.menu = GTK_MENU(dbusmenu_gtkmenu_new((gchar *)dbusaddress, (gchar *)dbusobject)); -- cgit v1.2.3 From ad8ca0d507d627da2221d39cd45c78e760623598 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 7 Jan 2010 01:06:45 -0600 Subject: Adding a path based debug message --- src/indicator-application.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/indicator-application.c') diff --git a/src/indicator-application.c b/src/indicator-application.c index e07386a..fbfbd40 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -279,6 +279,7 @@ application_added (DBusGProxy * proxy, const gchar * iconname, gint position, co app->icon_path = NULL; if (icon_path != NULL && icon_path[0] != '\0') { app->icon_path = g_strdup(icon_path); + g_debug("\tAppending search path: %s", app->icon_path); gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), app->icon_path); } -- cgit v1.2.3 From 655f6d113305163d87643f9282f09b96fe5ccbe5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 7 Jan 2010 14:07:16 -0600 Subject: Responding to the icon changed signal in the indicator. --- src/indicator-application.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/indicator-application.c') 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 -- cgit v1.2.3