GktIconTheme: Be more careful with paths

Slapping file:// in front of a path does not guarantee a working
uri (e.g. if you are on windows and the path looks like F:\\...).
Therefore, go back to using g_file_new_for_path if we don't have
to deal with a resource.
This commit is contained in:
Matthias Clasen 2014-07-14 18:44:00 -04:00
parent 64c2bafafc
commit 5a252f13a8

View File

@ -1759,7 +1759,6 @@ real_choose_icon (GtkIconTheme *icon_theme,
if (unthemed_icon)
{
gchar *uri;
icon_info = icon_info_new (ICON_THEME_DIR_UNTHEMED, size, 1);
/* A SVG icon, when allowed, beats out a XPM icon, but not a PNG icon */
@ -1772,13 +1771,17 @@ real_choose_icon (GtkIconTheme *icon_theme,
icon_info->filename = g_strdup (unthemed_icon->no_svg_filename);
if (unthemed_icon->is_resource)
uri = g_strconcat ("resource://", icon_info->filename, NULL);
{
gchar *uri;
uri = g_strconcat ("resource://", icon_info->filename, NULL);
icon_info->icon_file = g_file_new_for_uri (uri);
g_free (uri);
}
else
uri = g_strconcat ("file://", icon_info->filename, NULL);
icon_info->icon_file = g_file_new_for_uri (uri);
icon_info->icon_file = g_file_new_for_path (icon_info->filename);
icon_info->is_svg = suffix_from_name (icon_info->filename) == ICON_SUFFIX_SVG;
icon_info->is_resource = unthemed_icon->is_resource;
g_free (uri);
}
out: