Sophie

Sophie

distrib > Mandriva > 2008.1 > i586 > by-pkgid > 852a3e8c3d4b6cd27b5fd5d404ff9da0 > files > 1

libxfcegui4-4.4.2-6mdv2008.1.src.rpm

diff -Naur libxfcegui4-4.4.2/libxfcegui4/icons.c libxfcegui4-4.4.2.tpg/libxfcegui4/icons.c
--- libxfcegui4-4.4.2/libxfcegui4/icons.c	2007-11-17 19:29:54.000000000 +0000
+++ libxfcegui4-4.4.2.tpg/libxfcegui4/icons.c	2008-03-21 13:51:33.000000000 +0000
@@ -142,52 +142,62 @@
 
     ensure_gtk_icon_theme();
 
-    /* GtkIconTheme doesn't like extensions */
-    if((p = g_strrstr(name, ".")) && strlen(p) < 6)
-        name_fixed = g_strndup(name, p-name);
-    
-    pix = gtk_icon_theme_load_icon(icon_theme, name_fixed ? name_fixed : name,
-                                   size,
-                                   GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
-
-    if(!pix && (p = g_strrstr(name_fixed ? name_fixed : name, "/"))) {
-        pix = gtk_icon_theme_load_icon(icon_theme, p+1, size,
-                                       GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
-    }
-    
-    g_free(name_fixed);
-    
-    if (pix)
+    int i;
+    for (i = 0; i < 2; i++)
     {
-        int w, h;
+        if (i == 1)
+        {
+            /* For the second iteration to occur, an icon must not have been
+               found. So NOW try it without the 'extension' */
+            /* GtkIconTheme doesn't like extensions */
+            if((p = g_strrstr(name, ".")) && strlen(p) < 6)
+                name_fixed = g_strndup(name, p-name);
+        }
         
-        w = gdk_pixbuf_get_width (pix);
-        h = gdk_pixbuf_get_height (pix);
+        pix = gtk_icon_theme_load_icon(icon_theme, name_fixed ? name_fixed : name,
+                                       size,
+                                       GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+
+        if(!pix && (p = g_strrstr(name_fixed ? name_fixed : name, "/"))) {
+            pix = gtk_icon_theme_load_icon(icon_theme, p+1, size,
+                                           GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+        }
         
-        if (w > size || h > size)
-        {
-            GdkPixbuf *scaled; 
+        g_free(name_fixed);
         
-            if (w == h)
-            {
-                w = h = size;
-            }
-            else if (w < h)
-            {
-                h = rint ((double)h * (double)size / (double)w);
-                w = size;
-            }
-            else
+        if (pix)
+        {
+            int w, h;
+            
+            w = gdk_pixbuf_get_width (pix);
+            h = gdk_pixbuf_get_height (pix);
+            
+            if (w > size || h > size)
             {
-                w = rint ((double)w * (double)size / (double)h);
-                h = size;
-            }
+                GdkPixbuf *scaled; 
             
-            scaled = 
-                gdk_pixbuf_scale_simple (pix, w, h, GDK_INTERP_BILINEAR);
-            g_object_unref(pix);
-            pix = scaled;
+                if (w == h)
+                {
+                    w = h = size;
+                }
+                else if (w < h)
+                {
+                    h = rint ((double)h * (double)size / (double)w);
+                    w = size;
+                }
+                else
+                {
+                    w = rint ((double)w * (double)size / (double)h);
+                    h = size;
+                }
+                
+                scaled = 
+                    gdk_pixbuf_scale_simple (pix, w, h, GDK_INTERP_BILINEAR);
+                g_object_unref(pix);
+                pix = scaled;
+            }
         }
+        if (pix) break;
     }
     
     return pix;
@@ -220,20 +230,29 @@
     
     ensure_gtk_icon_theme();
     
-    /* GtkIconTheme doesn't like extensions */
-    if((p = g_strrstr(name, ".")) && strlen(p) < 6)
-        name_fixed = g_strndup(name, p-name);
-    
-    info = gtk_icon_theme_lookup_icon(icon_theme,
-                                      name_fixed ? name_fixed : name,
-                                      size, 0);
-    
-    if(!info && (p = g_strrstr(name_fixed ? name_fixed : name, "/")))
-        info = gtk_icon_theme_lookup_icon(icon_theme, p+1, size, 0);
-
-    if(info) {
-        filename = g_strdup(gtk_icon_info_get_filename(info));
-        gtk_icon_info_free(info);
+    int i;
+    for (i = 0; i < 2; i++)
+    {
+        if (i == 1)
+        {
+            /* GtkIconTheme doesn't like extensions */
+            if((p = g_strrstr(name, ".")) && strlen(p) < 6)
+                name_fixed = g_strndup(name, p-name);
+        }
+        
+        info = gtk_icon_theme_lookup_icon(icon_theme,
+                                          name_fixed ? name_fixed : name,
+                                          size, 0);
+        
+        if(!info && (p = g_strrstr(name_fixed ? name_fixed : name, "/")))
+            info = gtk_icon_theme_lookup_icon(icon_theme, p+1, size, 0);
+
+        if(info) {
+            filename = g_strdup(gtk_icon_info_get_filename(info));
+            gtk_icon_info_free(info);
+        }
+
+        if (filename) break;
     }
     
     g_free(name_fixed);