[gtk/wip/otte/icontheme: 17/26] icontheme: Remove NO_SVG and FORCE_SVG flags



commit 4c3363b8c22e8ef688486289cbbc9f73d33e1dc0
Author: Benjamin Otte <otte redhat com>
Date:   Sun Feb 2 00:42:43 2020 +0100

    icontheme: Remove NO_SVG and FORCE_SVG flags
    
    If the icon theme loads SVGs or not is an implementation detail and
    should not be exposed in public API.

 gtk/gtkicontheme.c | 20 ++++----------------
 gtk/gtkicontheme.h | 15 ++++-----------
 2 files changed, 8 insertions(+), 27 deletions(-)
---
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index 14e5b5a689..91dc0e0eaf 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -1827,7 +1827,6 @@ real_choose_icon (GtkIconTheme      *self,
   GtkIcon *unscaled_icon;
   UnthemedIcon *unthemed_icon = NULL;
   const gchar *icon_name = NULL;
-  gboolean allow_svg;
   IconTheme *theme = NULL;
   gint i;
   IconKey key;
@@ -1847,13 +1846,6 @@ real_choose_icon (GtkIconTheme      *self,
   if (icon)
     return icon;
 
-  if (flags & GTK_ICON_LOOKUP_NO_SVG)
-    allow_svg = FALSE;
-  else if (flags & GTK_ICON_LOOKUP_FORCE_SVG)
-    allow_svg = TRUE;
-  else
-    allow_svg = self->pixbuf_supports_svg;
-
   /* This is used in the icontheme unit test */
   GTK_DISPLAY_NOTE (self->display, ICONTHEME,
             for (i = 0; icon_names[i]; i++)
@@ -1873,7 +1865,7 @@ real_choose_icon (GtkIconTheme      *self,
       for (i = 0; icon_names[i] && icon_name_is_symbolic (icon_names[i], -1); i++)
         {
           icon_name = icon_names[i];
-          icon = theme_lookup_icon (theme, icon_name, size, scale, allow_svg);
+          icon = theme_lookup_icon (theme, icon_name, size, scale, self->pixbuf_supports_svg);
           if (icon)
             goto out;
         }
@@ -1886,7 +1878,7 @@ real_choose_icon (GtkIconTheme      *self,
       for (i = 0; icon_names[i]; i++)
         {
           icon_name = icon_names[i];
-          icon = theme_lookup_icon (theme, icon_name, size, scale, allow_svg);
+          icon = theme_lookup_icon (theme, icon_name, size, scale, self->pixbuf_supports_svg);
           if (icon)
             goto out;
         }
@@ -1930,7 +1922,7 @@ real_choose_icon (GtkIconTheme      *self,
       icon = icon_new (ICON_THEME_DIR_UNTHEMED, size, 1);
 
       /* A SVG icon, when allowed, beats out a XPM icon, but not a PNG icon */
-      if (allow_svg &&
+      if (self->pixbuf_supports_svg &&
           unthemed_icon->svg_filename &&
           (!unthemed_icon->no_svg_filename ||
            suffix_from_name (unthemed_icon->no_svg_filename) < ICON_CACHE_FLAG_PNG_SUFFIX))
@@ -1970,7 +1962,7 @@ real_choose_icon (GtkIconTheme      *self,
       icon->unscaled_scale = 1.0;
       if (scale != 1 && !icon->forced_size && theme != NULL)
         {
-          unscaled_icon = theme_lookup_icon (theme, icon_name, size, 1, allow_svg);
+          unscaled_icon = theme_lookup_icon (theme, icon_name, size, 1, self->pixbuf_supports_svg);
           if (unscaled_icon)
             {
               icon->unscaled_scale =
@@ -2202,8 +2194,6 @@ gtk_icon_theme_lookup_icon (GtkIconTheme       *self,
 
   g_return_val_if_fail (GTK_IS_ICON_THEME (self), NULL);
   g_return_val_if_fail (icon_name != NULL, NULL);
-  g_return_val_if_fail ((flags & GTK_ICON_LOOKUP_NO_SVG) == 0 ||
-                        (flags & GTK_ICON_LOOKUP_FORCE_SVG) == 0, NULL);
   g_return_val_if_fail (scale >= 1, NULL);
 
   GTK_DISPLAY_NOTE (self->display, ICONTHEME,
@@ -2329,8 +2319,6 @@ gtk_icon_theme_choose_icon (GtkIconTheme       *self,
 
   g_return_val_if_fail (GTK_IS_ICON_THEME (self), NULL);
   g_return_val_if_fail (icon_names != NULL, NULL);
-  g_return_val_if_fail ((flags & GTK_ICON_LOOKUP_NO_SVG) == 0 ||
-                        (flags & GTK_ICON_LOOKUP_FORCE_SVG) == 0, NULL);
   g_return_val_if_fail (scale >= 1, NULL);
   g_warn_if_fail ((flags & GTK_ICON_LOOKUP_GENERIC_FALLBACK) == 0);
 
diff --git a/gtk/gtkicontheme.h b/gtk/gtkicontheme.h
index 5ffe9b150e..f1a01773bf 100644
--- a/gtk/gtkicontheme.h
+++ b/gtk/gtkicontheme.h
@@ -42,11 +42,6 @@ typedef struct _GtkIconTheme    GtkIconTheme;
 
 /**
  * GtkIconLookupFlags:
- * @GTK_ICON_LOOKUP_NO_SVG: Never get SVG icons, even if gdk-pixbuf
- *   supports them. Cannot be used together with %GTK_ICON_LOOKUP_FORCE_SVG.
- * @GTK_ICON_LOOKUP_FORCE_SVG: Get SVG icons, even if gdk-pixbuf
- *   doesn’t support them.
- *   Cannot be used together with %GTK_ICON_LOOKUP_NO_SVG.
  * @GTK_ICON_LOOKUP_GENERIC_FALLBACK: Try to shorten icon name at '-'
  *   characters before looking at inherited themes. This flag is only
  *   supported in functions that take a single icon name. For more general
@@ -62,12 +57,10 @@ typedef struct _GtkIconTheme    GtkIconTheme;
  */
 typedef enum
 {
-  GTK_ICON_LOOKUP_NO_SVG           = 1 << 0,
-  GTK_ICON_LOOKUP_FORCE_SVG        = 1 << 1,
-  GTK_ICON_LOOKUP_GENERIC_FALLBACK = 1 << 2,
-  GTK_ICON_LOOKUP_FORCE_SIZE       = 1 << 3,
-  GTK_ICON_LOOKUP_FORCE_REGULAR    = 1 << 4,
-  GTK_ICON_LOOKUP_FORCE_SYMBOLIC   = 1 << 5
+  GTK_ICON_LOOKUP_GENERIC_FALLBACK = 1 << 0,
+  GTK_ICON_LOOKUP_FORCE_SIZE       = 1 << 1,
+  GTK_ICON_LOOKUP_FORCE_REGULAR    = 1 << 2,
+  GTK_ICON_LOOKUP_FORCE_SYMBOLIC   = 1 << 3
 } GtkIconLookupFlags;
 
 /**


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