summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Rostovtsev <tetromino@gentoo.org>2013-10-07 19:35:42 +0000
committerAlexandre Rostovtsev <tetromino@gentoo.org>2013-10-07 19:35:42 +0000
commit02251fe62b233f29c69f9b8c1d7fdf8c37bf1366 (patch)
tree1bff86e57d2b1b6ff4aa5690f923a5ca23f08cf0 /x11-libs/gtk+/files
parentStable for ppc, wrt bug #386335 (diff)
downloadgentoo-2-02251fe62b233f29c69f9b8c1d7fdf8c37bf1366.tar.gz
gentoo-2-02251fe62b233f29c69f9b8c1d7fdf8c37bf1366.tar.bz2
gentoo-2-02251fe62b233f29c69f9b8c1d7fdf8c37bf1366.zip
Fix symbolic icon loading with librsvg-2.36.4-r1 and 2.39.0 (bug #487110, thanks to pingoo).
(Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key CF0ADD61)
Diffstat (limited to 'x11-libs/gtk+/files')
-rw-r--r--x11-libs/gtk+/files/gtk+-3.6.3-librsvg-2.39.patch70
1 files changed, 70 insertions, 0 deletions
diff --git a/x11-libs/gtk+/files/gtk+-3.6.3-librsvg-2.39.patch b/x11-libs/gtk+/files/gtk+-3.6.3-librsvg-2.39.patch
new file mode 100644
index 000000000000..42d3c9c05b18
--- /dev/null
+++ b/x11-libs/gtk+/files/gtk+-3.6.3-librsvg-2.39.patch
@@ -0,0 +1,70 @@
+From b26c7c4b74de9767e5a7f0b72b590fb78a9c3adf Mon Sep 17 00:00:00 2001
+From: Matthias Clasen <mclasen@redhat.com>
+Date: Fri, 16 Aug 2013 18:57:21 -0400
+Subject: [PATCH] Make symbolic icons work with the current rsvg
+
+The rsvg loader now restricts what external files it will
+allow to load from an svg. Thus our xinclude trick doesn't work
+anymore. To work around that, embed the payload in a data: uri.
+This is somewhat ugly, but the best we could come up with.
+
+[Alexandre Rostovtsev <tetromino@gentoo.org>: backport to 3.6.3]
+---
+ gtk/gtkicontheme.c | 15 +++++++++++++--
+ 1 file changed, 13 insertions(+), 2 deletions(-)
+
+diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
+index 58b643f..fef4283 100644
+--- a/gtk/gtkicontheme.c
++++ b/gtk/gtkicontheme.c
+@@ -3174,6 +3174,8 @@ _gtk_icon_info_load_symbolic_internal (GtkIconInfo *icon_info,
+ gchar *data;
+ gchar *success, *warning, *err;
+ gchar *width, *height;
++ gchar *file_data, *escaped_file_data;
++ gsize file_len;
+
+ /* css_fg can't possibly have failed, otherwise
+ * that would mean we have a broken style */
+@@ -3197,10 +3199,15 @@ _gtk_icon_info_load_symbolic_internal (GtkIconInfo *icon_info,
+ err = gdk_color_to_css (&error_default_color);
+ }
+
++ if (!g_file_get_contents (icon_info->filename, &file_data, &file_len, NULL))
++ return NULL;
++
+ if (!icon_info->symbolic_pixbuf_size)
+ {
+ /* Fetch size from the original icon */
+- pixbuf = gdk_pixbuf_new_from_file (icon_info->filename, error);
++ stream = g_memory_input_stream_new_from_data (file_data, file_len, NULL);
++ pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, error);
++ g_object_unref (stream);
+
+ if (!pixbuf)
+ return NULL;
+@@ -3214,6 +3221,9 @@ _gtk_icon_info_load_symbolic_internal (GtkIconInfo *icon_info,
+ width = g_strdup_printf ("%d", icon_info->symbolic_pixbuf_size->width);
+ height = g_strdup_printf ("%d", icon_info->symbolic_pixbuf_size->height);
+
++ escaped_file_data = g_markup_escape_text (file_data, file_len);
++ g_free (file_data);
++
+ data = g_strconcat ("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
+ "<svg version=\"1.1\"\n"
+ " xmlns=\"http://www.w3.org/2000/svg\"\n"
+@@ -3234,9 +3244,10 @@ _gtk_icon_info_load_symbolic_internal (GtkIconInfo *icon_info,
+ " fill: ", css_success ? css_success : success," !important;\n"
+ " }\n"
+ " </style>\n"
+- " <xi:include href=\"", icon_info->filename, "\"/>\n"
++ " <xi:include href=\"data:text/xml,", escaped_file_data, "\"/>\n"
+ "</svg>",
+ NULL);
++ g_free (escaped_file_data);
+ g_free (warning);
+ g_free (err);
+ g_free (success);
+--
+1.8.3.2
+