[gtk/wip/otte/icontheme: 3/9] icontheme: Remove NO_SVG and FORCE_SVG flags



commit 647443fdd6d0a49c5a46ec5c922a59e0f6caa1e2
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 dd61a21755..c80c175c4d 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -1846,7 +1846,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;
@@ -1866,13 +1865,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++)
@@ -1892,7 +1884,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;
         }
@@ -1905,7 +1897,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;
         }
@@ -1949,7 +1941,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_SUFFIX_PNG))
@@ -1989,7 +1981,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 =
@@ -2221,8 +2213,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,
@@ -2348,8 +2338,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 42008c5e62..8a785da879 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
@@ -66,12 +61,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]