[gtk+] icontheme: fill correct information when loading GResource-backed GIcons



commit acd72ffabe88ae4078e1cc1c4c2377c6ea5aac5c
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sun Feb 22 17:49:55 2015 -0800

    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

 gtk/gtkicontheme.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index dc82b45..2f45f63 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -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;
             }
         }


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