[Goodies-commits] r5341 - xfce4-mailwatch-plugin/trunk/panel-plugin

Brian Tarricone kelnos at xfce.org
Tue Sep 2 02:04:16 CEST 2008


Author: kelnos
Date: 2008-09-02 00:04:15 +0000 (Tue, 02 Sep 2008)
New Revision: 5341

Modified:
   xfce4-mailwatch-plugin/trunk/panel-plugin/mailwatch-plugin.c
Log:
fix loading icons with absolute paths

Modified: xfce4-mailwatch-plugin/trunk/panel-plugin/mailwatch-plugin.c
===================================================================
--- xfce4-mailwatch-plugin/trunk/panel-plugin/mailwatch-plugin.c	2008-09-01 12:40:13 UTC (rev 5340)
+++ xfce4-mailwatch-plugin/trunk/panel-plugin/mailwatch-plugin.c	2008-09-02 00:04:15 UTC (rev 5341)
@@ -284,10 +284,10 @@
                    XfceMailwatchPlugin *mwp)
 {
     gint size, img_width, img_height, width, height, i;
-    gchar *icon;
+    const gchar *icon;
     GdkPixbuf *pb;
     GtkIconTheme *itheme;
-    GtkIconInfo *info;
+    GtkIconInfo *info = NULL;
     
     /* this is such lame lame voodoo magic.  the x/ythickness stuff
      * shouldn't be needed, since i think the panel button convienence
@@ -318,23 +318,33 @@
     itheme = gtk_icon_theme_get_for_screen(gtk_widget_get_screen(GTK_WIDGET(plugin)));
 
     icon = mwp->normal_icon ? mwp->normal_icon : DEFAULT_NORMAL_ICON;
-    info = gtk_icon_theme_lookup_icon(itheme, icon, size, 0);
+    if(!g_path_is_absolute(icon)) {
+        info = gtk_icon_theme_lookup_icon(itheme, icon, size, 0);
+        if(info)
+            icon = gtk_icon_info_get_filename(info);
+    }
+
+    mwp->pix_normal = gdk_pixbuf_new_from_file_at_scale(icon, img_width,
+                                                        img_height, TRUE,
+                                                        NULL);
     if(info) {
-        const gchar *file = gtk_icon_info_get_filename(info);
-        mwp->pix_normal = gdk_pixbuf_new_from_file_at_scale(file, img_width,
-                                                            img_height, TRUE,
-                                                            NULL);
         gtk_icon_info_free(info);
+        info = NULL;
     }
 
     icon = mwp->new_mail_icon ? mwp->new_mail_icon : DEFAULT_NEW_MAIL_ICON;
-    info = gtk_icon_theme_lookup_icon(itheme, icon, size, 0);
+    if(!g_path_is_absolute(icon)) {
+        info = gtk_icon_theme_lookup_icon(itheme, icon, size, 0);
+        if(info)
+            icon = gtk_icon_info_get_filename(info);
+    }
+
+    mwp->pix_newmail = gdk_pixbuf_new_from_file_at_scale(icon, img_width,
+                                                        img_height, TRUE,
+                                                        NULL);
     if(info) {
-        const gchar *file = gtk_icon_info_get_filename(info);
-        mwp->pix_newmail = gdk_pixbuf_new_from_file_at_scale(file, img_width,
-                                                            img_height, TRUE,
-                                                            NULL);
         gtk_icon_info_free(info);
+        info = NULL;
     }
 
     /* find the smallest dimensions of the two icons */




More information about the Goodies-commits mailing list