icontheme: Remove NO_SVG and FORCE_SVG flags
authorBenjamin Otte <otte@redhat.com>
Sat, 1 Feb 2020 23:42:43 +0000 (00:42 +0100)
committerAlexander Larsson <alexl@redhat.com>
Tue, 4 Feb 2020 15:41:36 +0000 (16:41 +0100)
If the icon theme loads SVGs or not is an implementation detail and
should not be exposed in public API.

gtk/gtkicontheme.c
gtk/gtkicontheme.h

index 14e5b5a68969f851d178da93568e7ee62249a471..91dc0e0eaff62f83012dafb7e9cb414a3c6148cb 100644 (file)
@@ -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);
 
index 5ffe9b150ed10882898bf21f1db7efbf06fc0ac0..f1a01773bfa1a82c6e1ad8e6858abc14c6ba2048 100644 (file)
@@ -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;
 
 /**