[gtk+/wip/css-icons: 11/15] icontheme: Don't force missing icon



commit a331bab4828ea2639cd415ab8401025a0320ce53
Author: Benjamin Otte <otte redhat com>
Date:   Sun May 11 02:30:50 2014 +0200

    icontheme: Don't force missing icon
    
    When forcing regular or symbolic icons, fall back to the default
    specified icons. This ensures that when no symbolic icon is present, an
    icon will still appear - the regular one.

 gtk/gtkicontheme.c |   31 +++++++++++++++++++++++--------
 gtk/gtkicontheme.h |    8 ++++----
 2 files changed, 27 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index b381cde..d875a2a 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -1824,6 +1824,17 @@ choose_icon (GtkIconTheme       *icon_theme,
           else
             new_names[i] = g_strdup (icon_names[i]);
         }
+
+      icon_info = real_choose_icon (icon_theme,
+                                    (const gchar **) new_names,
+                                    size,
+                                    scale,
+                                    flags & ~(GTK_ICON_LOOKUP_FORCE_REGULAR | 
GTK_ICON_LOOKUP_FORCE_SYMBOLIC));
+
+      g_strfreev (new_names);
+
+      if (icon_info)
+        return icon_info;
     }
   else if ((flags & GTK_ICON_LOOKUP_FORCE_SYMBOLIC) && has_regular)
     {
@@ -1835,21 +1846,25 @@ choose_icon (GtkIconTheme       *icon_theme,
           else
             new_names[i] = g_strdup (icon_names[i]);
         }
-    }
-  else
-    {
-      new_names = NULL;
+
+      icon_info = real_choose_icon (icon_theme,
+                                    (const gchar **) new_names,
+                                    size,
+                                    scale,
+                                    flags & ~(GTK_ICON_LOOKUP_FORCE_REGULAR | 
GTK_ICON_LOOKUP_FORCE_SYMBOLIC));
+
+      g_strfreev (new_names);
+
+      if (icon_info)
+        return icon_info;
     }
 
   icon_info = real_choose_icon (icon_theme,
-                                new_names ? (const gchar **) new_names : icon_names,
+                                icon_names,
                                 size,
                                 scale,
                                 flags & ~(GTK_ICON_LOOKUP_FORCE_REGULAR | GTK_ICON_LOOKUP_FORCE_SYMBOLIC));
 
-  if (new_names)
-    g_strfreev (new_names);
-
   return icon_info;
 }
 
diff --git a/gtk/gtkicontheme.h b/gtk/gtkicontheme.h
index bdbaafe..c11cfab 100644
--- a/gtk/gtkicontheme.h
+++ b/gtk/gtkicontheme.h
@@ -113,10 +113,10 @@ struct _GtkIconThemeClass
  *   fallback, see gtk_icon_theme_choose_icon(). Since 2.12.
  * @GTK_ICON_LOOKUP_FORCE_SIZE: Always get the icon scaled to the
  *   requested size. Since 2.14.
- * @GTK_ICON_LOOKUP_FORCE_REGULAR: Always load regular icons, even when
- *   symbolic icon names are given. Since 3.14.
- * @GTK_ICON_LOOKUP_FORCE_SYMBOLIC: Always load symbolic icons, even when
- *   regular icon names are given. Since 3.14.
+ * @GTK_ICON_LOOKUP_FORCE_REGULAR: Try to always load regular icons, even
+ *   when symbolic icon names are given. Since 3.14.
+ * @GTK_ICON_LOOKUP_FORCE_SYMBOLIC: Try to always load symbolic icons, even
+ *   when regular icon names are given. Since 3.14.
  * 
  * Used to specify options for gtk_icon_theme_lookup_icon()
  */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]