[gtk+] GktIconTheme: Be more careful with paths



commit 5a252f13a863c00ccd9901afa110e85836a6af4c
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Jul 14 18:44:00 2014 -0400

    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.

 gtk/gtkicontheme.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index bf69dd8..42cb138 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -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:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]