icontheme: fill correct information when loading GResource-backed GIcons

When loading a GResource-backed GFileIcon into a GtkIconInfo we
currently fail to populate the is_resource private field.
Also, since is_svg is set by looking at the filename, and
g_file_get_path() returns NULL for a GResourceFile, is_svg was always
FALSE.

https://bugzilla.gnome.org/show_bug.cgi?id=744991
This commit is contained in:
Cosimo Cecchi 2015-02-22 17:49:55 -08:00
parent e7a2fc2d01
commit acd72ffabe

View File

@ -5451,7 +5451,21 @@ gtk_icon_theme_lookup_by_gicon_for_scale (GtkIconTheme *icon_theme,
if (file != NULL)
{
info->icon_file = g_object_ref (file);
info->filename = g_file_get_path (file);
info->is_resource = g_file_has_uri_scheme (file, "resource");
if (info->is_resource)
{
gchar *uri;
uri = g_file_get_uri (file);
info->filename = g_strdup (uri + 11); /* resource:// */
g_free (uri);
}
else
{
info->filename = g_file_get_path (file);
}
info->is_svg = suffix_from_name (info->filename) == ICON_SUFFIX_SVG;
}
}