From 79cd82fa83fd9f13c4b1187e68264c1ec5eb2ffe Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sun, 24 Jan 2010 21:56:07 -0600 Subject: When setting or changing an icon first check to see if there is a panel specific icon that we should be using. --- src/indicator-application.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/indicator-application.c b/src/indicator-application.c index 3ef5688..68f7d0e 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -41,6 +41,8 @@ with this program. If not, see . #include "application-service-client.h" #include "application-service-marshal.h" +#define PANEL_ICON_SUFFIX "symbolic" + #define INDICATOR_APPLICATION_TYPE (indicator_application_get_type ()) #define INDICATOR_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_APPLICATION_TYPE, IndicatorApplication)) #define INDICATOR_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), INDICATOR_APPLICATION_TYPE, IndicatorApplicationClass)) @@ -325,7 +327,17 @@ application_added (DBusGProxy * proxy, const gchar * iconname, gint position, co theme_dir_ref(application, icon_path); } - app->entry.image = GTK_IMAGE(gtk_image_new_from_icon_name(iconname, GTK_ICON_SIZE_MENU)); + /* We make a long name using the suffix, and if that + icon is available we want to use it. Otherwise we'll + just use the name we were given. */ + gchar * longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX); + if (!gtk_icon_theme_has_icon(gtk_icon_theme_get_default(), longname)) { + app->entry.image = GTK_IMAGE(gtk_image_new_from_icon_name(longname, GTK_ICON_SIZE_MENU)); + } else { + app->entry.image = GTK_IMAGE(gtk_image_new_from_icon_name(iconname, GTK_ICON_SIZE_MENU)); + } + g_free(longname); + app->entry.label = NULL; app->entry.menu = GTK_MENU(dbusmenu_gtkmenu_new((gchar *)dbusaddress, (gchar *)dbusobject)); @@ -390,7 +402,17 @@ application_icon_changed (DBusGProxy * proxy, gint position, const gchar * iconn return; } - gtk_image_set_from_icon_name(app->entry.image, iconname, GTK_ICON_SIZE_MENU); + /* We make a long name using the suffix, and if that + icon is available we want to use it. Otherwise we'll + just use the name we were given. */ + gchar * longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX); + if (!gtk_icon_theme_has_icon(gtk_icon_theme_get_default(), longname)) { + gtk_image_set_from_icon_name(app->entry.image, longname, GTK_ICON_SIZE_MENU); + } else { + gtk_image_set_from_icon_name(app->entry.image, iconname, GTK_ICON_SIZE_MENU); + } + g_free(longname); + return; } -- cgit v1.2.3 From e68b4e3f23ad6b5e1f909fc50d86d0cc7d24e88f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sun, 24 Jan 2010 22:03:21 -0600 Subject: Truth. Bad, Bad, truth. --- src/indicator-application.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/indicator-application.c b/src/indicator-application.c index 68f7d0e..5327ff2 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -331,7 +331,7 @@ application_added (DBusGProxy * proxy, const gchar * iconname, gint position, co icon is available we want to use it. Otherwise we'll just use the name we were given. */ gchar * longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX); - if (!gtk_icon_theme_has_icon(gtk_icon_theme_get_default(), longname)) { + if (gtk_icon_theme_has_icon(gtk_icon_theme_get_default(), longname)) { app->entry.image = GTK_IMAGE(gtk_image_new_from_icon_name(longname, GTK_ICON_SIZE_MENU)); } else { app->entry.image = GTK_IMAGE(gtk_image_new_from_icon_name(iconname, GTK_ICON_SIZE_MENU)); @@ -406,7 +406,7 @@ application_icon_changed (DBusGProxy * proxy, gint position, const gchar * iconn icon is available we want to use it. Otherwise we'll just use the name we were given. */ gchar * longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX); - if (!gtk_icon_theme_has_icon(gtk_icon_theme_get_default(), longname)) { + if (gtk_icon_theme_has_icon(gtk_icon_theme_get_default(), longname)) { gtk_image_set_from_icon_name(app->entry.image, longname, GTK_ICON_SIZE_MENU); } else { gtk_image_set_from_icon_name(app->entry.image, iconname, GTK_ICON_SIZE_MENU); -- cgit v1.2.3 From 8a8c965f7fafd65b427a7cdc90cba59456889396 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 1 Feb 2010 10:21:58 -0800 Subject: Changing the suffix to 'panel' --- src/indicator-application.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/indicator-application.c b/src/indicator-application.c index 5327ff2..6c053a9 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -41,7 +41,7 @@ with this program. If not, see . #include "application-service-client.h" #include "application-service-marshal.h" -#define PANEL_ICON_SUFFIX "symbolic" +#define PANEL_ICON_SUFFIX "panel" #define INDICATOR_APPLICATION_TYPE (indicator_application_get_type ()) #define INDICATOR_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_APPLICATION_TYPE, IndicatorApplication)) -- cgit v1.2.3