Mercurial > audlegacy-plugins
changeset 2427:e041adc026a8
Status Icon can now be changed, patch provided by Matteo (Bugzilla #182)
author | Cristi Magherusan <majeru@atheme.org> |
---|---|
date | Mon, 25 Feb 2008 15:15:46 +0200 |
parents | 39be83376f18 |
children | 5ba6588580e0 |
files | src/statusicon/si_ui.c |
diffstat | 1 files changed, 31 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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 <audacious/playlist.h> #include <audacious/main.h> #include <audacious/ui_fileinfopopup.h> @@ -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 );