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.
This commit is contained in:
Benjamin Otte 2020-02-02 00:42:43 +01:00 committed by Alexander Larsson
parent 10023b5d6d
commit 4c3363b8c2
2 changed files with 8 additions and 27 deletions

View 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);

View 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
* doesnt 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;
/**