aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-11-16 19:52:02 +0000
committerConor Curran <conor.curran@canonical.com>2010-11-16 19:52:02 +0000
commit6c882bee8faa60b3eeac4246adfcfdc10a5cadbf (patch)
tree422e71dc57722b54bd8e7b84b5f319d0c3b30840
parentee981578fa2261bdea4a3c6bd0beaf89e7ed11e8 (diff)
downloadayatana-indicator-sound-6c882bee8faa60b3eeac4246adfcfdc10a5cadbf.tar.gz
ayatana-indicator-sound-6c882bee8faa60b3eeac4246adfcfdc10a5cadbf.tar.bz2
ayatana-indicator-sound-6c882bee8faa60b3eeac4246adfcfdc10a5cadbf.zip
title widget icon implemented as discussed at uds
-rw-r--r--src/title-widget.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/title-widget.c b/src/title-widget.c
index 73f846a..0754958 100644
--- a/src/title-widget.c
+++ b/src/title-widget.c
@@ -85,23 +85,40 @@ title_widget_set_icon(TitleWidget *self)
gint padding = 0;
gtk_widget_style_get(GTK_WIDGET(self), "horizontal-padding", &padding, NULL);
-
gint width, height;
gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);
+
+ GString* banshee_string = g_string_new ( "banshee" );
GString* app_panel = g_string_new ( g_utf8_strdown ( dbusmenu_menuitem_property_get(priv->twin_item, DBUSMENU_TITLE_MENUITEM_NAME),
- -1 ));
- g_string_append(app_panel, "-panel");
- GtkWidget * icon = gtk_image_new_from_icon_name( g_string_free ( app_panel, FALSE),
- GTK_ICON_SIZE_MENU );
+ -1 ));
+ GtkWidget * icon = NULL;
+
+ // Not ideal but apparently we want the banshee icon to be the greyscale one
+ // and any others to be the icon from the desktop file => colour.
+ if ( g_string_equal ( banshee_string, app_panel ) == TRUE &&
+ gtk_icon_theme_has_icon ( gtk_icon_theme_get_default(), app_panel->str ) ){
+ g_string_append ( app_panel, "-panel" );
+ icon = gtk_image_new_from_icon_name ( app_panel->str,
+ GTK_ICON_SIZE_MENU );
+ }
+ else{
+ icon = gtk_image_new_from_icon_name ( g_strdup (dbusmenu_menuitem_property_get ( priv->twin_item, DBUSMENU_TITLE_MENUITEM_ICON )),
+ GTK_ICON_SIZE_MENU );
+ }
+ g_string_free ( app_panel, FALSE) ;
+ g_string_free ( banshee_string, FALSE) ;
+
gtk_widget_set_size_request(icon, width
+ 5 /* ref triangle is 5x9 pixels */
+ 1 /* padding */,
height);
gtk_misc_set_alignment(GTK_MISC(icon), 0.5 /* right aligned */, 0);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(self), GTK_WIDGET(icon));
- gtk_widget_show(icon);
+ gtk_widget_show(icon);
}
+
+
static void
title_widget_dispose (GObject *object)
{