# HG changeset patch # User Cristi Magherusan # Date 1203945346 -7200 # Node ID e041adc026a88c16603d257b8e1d3c593dcca0b9 # Parent 39be83376f186ef5eba588c86a3dd6d95f01caca Status Icon can now be changed, patch provided by Matteo (Bugzilla #182) diff -r 39be83376f18 -r e041adc026a8 src/statusicon/si_ui.c --- a/src/statusicon/si_ui.c Mon Feb 25 14:38:37 2008 +0200 +++ b/src/statusicon/si_ui.c Mon Feb 25 15:15:46 2008 +0200 @@ -23,7 +23,6 @@ #include "si_cfg.h" #include "si_common.h" #include "gtktrayicon.h" -#include "si.xpm" #include #include #include @@ -355,8 +354,37 @@ } if ( ( size <= 1 || size > 22 ) && ( wmname != NULL ) && !strcmp("KWin",wmname) ) size = 22; - - si_pixbuf = gdk_pixbuf_new_from_xpm_data( (const char**)si_xpm ); + GtkIconTheme *theme; + GtkIconInfo *info; + int *array; + int i; + const gchar *path; + gboolean scalable = FALSE; + gboolean catch = FALSE; + + theme = gtk_icon_theme_get_default (); + array = gtk_icon_theme_get_icon_sizes (theme, "audacious"); + if (array[0] != 0) { + for (i = 0; array[i] != 0; i++) { + if (array[i] == -1) + scalable = TRUE; + if (array[i] == 22) + catch = TRUE; + } + } + g_free (array); + if (catch) { + info = gtk_icon_theme_lookup_icon (theme, "audacious", 22, GTK_ICON_LOOKUP_NO_SVG); + path = gtk_icon_info_get_filename (info); + si_pixbuf = gdk_pixbuf_new_from_file (path, NULL); + } else if (scalable) { + info = gtk_icon_theme_lookup_icon (theme, "audacious", -1, GTK_ICON_LOOKUP_FORCE_SVG); + path = gtk_icon_info_get_filename (info); + si_pixbuf = gdk_pixbuf_new_from_file (path, NULL); + + } else { + si_pixbuf = gdk_pixbuf_new_from_file ("/usr/share/audacious/images/audacious_player.xpm", NULL); + } si_scaled_pixbuf = gdk_pixbuf_scale_simple( si_pixbuf , size , size , GDK_INTERP_BILINEAR ); gtk_image_set_from_pixbuf( GTK_IMAGE(image) , si_scaled_pixbuf ); g_object_unref( si_pixbuf );