summaryrefslogtreecommitdiff
path: root/gtk/gtkicontheme.c
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2014-01-18 11:47:43 -0500
committerJasper St. Pierre <jstpierre@mecheye.net>2014-01-31 14:34:52 -0500
commitf929a613999bd4f895bb466f497b9d009cae4e85 (patch)
treea63031360b70fa6ee9efae924c24a38b8627818d /gtk/gtkicontheme.c
parent78169aa19201c4900888a0f9765ae7e567467989 (diff)
downloadgtk+-f929a613999bd4f895bb466f497b9d009cae4e85.tar.gz
gtkicontheme: Don't query CONTENT_TYPE to determine if something is an SVG
We already know based on the suffix of the filename. https://bugzilla.gnome.org/show_bug.cgi?id=721895
Diffstat (limited to 'gtk/gtkicontheme.c')
-rw-r--r--gtk/gtkicontheme.c34
1 files changed, 9 insertions, 25 deletions
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index 959fc037e5..898898a7bb 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -266,6 +266,7 @@ struct _GtkIconInfo
guint raw_coordinates : 1;
guint forced_size : 1;
guint emblems_applied : 1;
+ guint is_svg : 1;
/* Cached information if we go ahead and try to load
* the icon.
@@ -1729,6 +1730,13 @@ choose_icon (GtkIconTheme *icon_theme,
out:
if (icon_info)
{
+ if (icon_info->filename)
+ icon_info->is_svg = (suffix_from_name (icon_info->filename) == ICON_SUFFIX_SVG);
+ else
+ /* This can only happen when we have an icon cache. In this case, we know we're
+ * not dealing with an SVG, but with raw pixel data. */
+ icon_info->is_svg = FALSE;
+
icon_info->desired_size = size;
icon_info->desired_scale = scale;
icon_info->forced_size = (flags & GTK_ICON_LOOKUP_FORCE_SIZE) != 0;
@@ -3683,7 +3691,6 @@ icon_info_ensure_scale_and_pixbuf (GtkIconInfo *icon_info,
int image_width, image_height;
int scaled_desired_size;
GdkPixbuf *source_pixbuf;
- gboolean is_svg;
/* First check if we already succeeded have the necessary
* information (or failed earlier)
@@ -3708,30 +3715,7 @@ icon_info_ensure_scale_and_pixbuf (GtkIconInfo *icon_info,
scaled_desired_size = icon_info->desired_size * icon_info->desired_scale;
- is_svg = FALSE;
- if (G_IS_FILE_ICON (icon_info->loadable))
- {
- GFile *file;
- GFileInfo *file_info;
- const gchar *content_type;
-
- file = g_file_icon_get_file (G_FILE_ICON (icon_info->loadable));
- file_info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
- G_FILE_QUERY_INFO_NONE,
- NULL, NULL);
- if (file_info)
- {
- content_type = g_file_info_get_content_type (file_info);
-
- if (content_type && strcmp (content_type, "image/svg+xml") == 0)
- is_svg = TRUE;
-
- g_object_unref (file_info);
- }
- }
-
- if (is_svg)
+ if (icon_info->is_svg)
{
GInputStream *stream;