set the base URI so that librsvg can resolve relative paths.

2007-08-06  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/svg.c (load_rsvg_pixbuf): set the base URI so
	that librsvg can resolve relative paths.

svn path=/trunk/; revision=23122
This commit is contained in:
Sven Neumann 2007-08-06 08:57:25 +00:00 committed by Sven Neumann
parent fd982a04bf
commit 99e399e523
2 changed files with 26 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2007-08-06 Sven Neumann <sven@gimp.org>
* plug-ins/common/svg.c (load_rsvg_pixbuf): set the base URI so
that librsvg can resolve relative paths.
2007-08-05 Sven Neumann <sven@gimp.org>
* configure.in: don't build linux-input controller module if

View file

@ -314,6 +314,7 @@ load_image (const gchar *filename)
GError *error = NULL;
pixbuf = load_rsvg_pixbuf (filename, &load_vals, &error);
if (!pixbuf)
{
/* Do not rely on librsvg setting GError on failure! */
@ -421,6 +422,7 @@ load_rsvg_pixbuf (const gchar *filename,
GdkPixbuf *pixbuf = NULL;
RsvgHandle *handle;
GIOChannel *io;
gchar *uri;
GIOStatus status = G_IO_STATUS_NORMAL;
gboolean success = TRUE;
@ -432,6 +434,19 @@ load_rsvg_pixbuf (const gchar *filename,
handle = load_rsvg_handle_new (vals->resolution, vals->resolution);
/* set the base URI so that librsvg can resolve relative paths */
uri = g_filename_to_uri (filename, NULL, NULL);
if (uri)
{
gchar *p = strrchr (uri, '/');
if (p)
*p = '\0';
rsvg_handle_set_base_uri (handle, uri);
g_free (uri);
}
rsvg_handle_set_size_callback (handle, load_set_size_callback, vals, NULL);
while (success && status != G_IO_STATUS_EOF)
@ -672,8 +687,12 @@ load_dialog (const gchar *filename)
gboolean run;
GError *error = NULL;
SvgLoadVals vals = { SVG_DEFAULT_RESOLUTION,
- SVG_PREVIEW_SIZE, - SVG_PREVIEW_SIZE };
SvgLoadVals vals =
{
SVG_DEFAULT_RESOLUTION,
- SVG_PREVIEW_SIZE,
- SVG_PREVIEW_SIZE
};
preview = load_rsvg_pixbuf (filename, &vals, &error);