mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
Add GTK_ICON_LOOKUP_GENERIC_FALLBACK icon lookup flag and implement it.
2007-04-19 Matthias Clasen <mclasen@redhat.com> * gtk/gtkicontheme.h: * gtk/gtkicontheme.c: Add GTK_ICON_LOOKUP_GENERIC_FALLBACK icon lookup flag and implement it. (#396901, Luca Ferreti) svn path=/trunk/; revision=17611
This commit is contained in:
parent
c8d89a96a2
commit
5a706b553b
@ -1,3 +1,9 @@
|
||||
2007-04-19 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtkicontheme.h:
|
||||
* gtk/gtkicontheme.c: Add GTK_ICON_LOOKUP_GENERIC_FALLBACK
|
||||
icon lookup flag and implement it. (#396901, Luca Ferreti)
|
||||
|
||||
2007-04-18 Richard Hult <richard@imendio.com>
|
||||
|
||||
* gdk/quartz/gdkwindow-quartz.c:
|
||||
|
@ -1256,6 +1256,7 @@ gtk_icon_theme_lookup_icon (GtkIconTheme *icon_theme,
|
||||
UnthemedIcon *unthemed_icon;
|
||||
gboolean allow_svg;
|
||||
gboolean use_builtin;
|
||||
gboolean generic_fallback;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ICON_THEME (icon_theme), NULL);
|
||||
g_return_val_if_fail (icon_name != NULL, NULL);
|
||||
@ -1273,15 +1274,33 @@ gtk_icon_theme_lookup_icon (GtkIconTheme *icon_theme,
|
||||
else
|
||||
allow_svg = priv->pixbuf_supports_svg;
|
||||
|
||||
use_builtin = (flags & GTK_ICON_LOOKUP_USE_BUILTIN);
|
||||
|
||||
use_builtin = flags & GTK_ICON_LOOKUP_USE_BUILTIN;
|
||||
generic_fallback = flags & GTK_ICON_LOOKUP_GENERIC_FALLBACK;
|
||||
|
||||
ensure_valid_themes (icon_theme);
|
||||
|
||||
for (l = priv->themes; l; l = l->next)
|
||||
{
|
||||
IconTheme *theme = l->data;
|
||||
|
||||
icon_info = theme_lookup_icon (theme, icon_name, size, allow_svg, use_builtin);
|
||||
gchar *name = g_strdup (icon_name);
|
||||
gchar *s;
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
icon_info = theme_lookup_icon (theme, name, size, allow_svg, use_builtin);
|
||||
if (icon_info || !generic_fallback)
|
||||
break;
|
||||
|
||||
s = strrchr (name, '-');
|
||||
if (!s)
|
||||
break;
|
||||
|
||||
*s = '\0';
|
||||
}
|
||||
|
||||
g_free (name);
|
||||
|
||||
if (icon_info)
|
||||
goto out;
|
||||
}
|
||||
|
@ -66,6 +66,8 @@ struct _GtkIconThemeClass
|
||||
* gtk_icon_theme_lookup_icon() includes builtin icons
|
||||
* as well as files. For a builtin icon, gtk_icon_info_get_filename()
|
||||
* returns %NULL and you need to call gtk_icon_info_get_builtin_pixbuf().
|
||||
* @GTK_ICON_LOOKUP_GENERIC_FALLBACK: Try to shorten icon name at '-'
|
||||
* characters before looking at inherited themes.
|
||||
*
|
||||
* Used to specify options for gtk_icon_theme_lookup_icon()
|
||||
**/
|
||||
@ -73,7 +75,8 @@ typedef enum
|
||||
{
|
||||
GTK_ICON_LOOKUP_NO_SVG = 1 << 0,
|
||||
GTK_ICON_LOOKUP_FORCE_SVG = 1 << 1,
|
||||
GTK_ICON_LOOKUP_USE_BUILTIN = 1 << 2
|
||||
GTK_ICON_LOOKUP_USE_BUILTIN = 1 << 2,
|
||||
GTK_ICON_LOOKUP_GENERIC_FALLBACK = 1 << 3
|
||||
} GtkIconLookupFlags;
|
||||
|
||||
#define GTK_ICON_THEME_ERROR gtk_icon_theme_error_quark ()
|
||||
|
Loading…
Reference in New Issue
Block a user