diff options
author | Alexander Larsson <alexl@redhat.com> | 2012-01-16 11:18:42 +0100 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2012-01-16 14:19:19 +0100 |
commit | e46971306a7d1997144669b84c2a59ba0324d5c5 (patch) | |
tree | 192557f2dfcd0c8aed593e20aa23c46d79bad1c8 /gtk/gtkcssimageurl.c | |
parent | 6afeb8d3554666d2d88855b12d2cf16475443c1c (diff) | |
download | gtk+-e46971306a7d1997144669b84c2a59ba0324d5c5.tar.gz |
Ensure we can load images via resource:// uris from CSS
Diffstat (limited to 'gtk/gtkcssimageurl.c')
-rw-r--r-- | gtk/gtkcssimageurl.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/gtk/gtkcssimageurl.c b/gtk/gtkcssimageurl.c index 2f1cca9a47..a548d93125 100644 --- a/gtk/gtkcssimageurl.c +++ b/gtk/gtkcssimageurl.c @@ -67,19 +67,25 @@ gtk_css_image_url_parse (GtkCssImage *image, GtkCssImageUrl *url = GTK_CSS_IMAGE_URL (image); GdkPixbuf *pixbuf; GFile *file; - char *path; cairo_t *cr; GError *error = NULL; + GFileInputStream *input; file = _gtk_css_parser_read_url (parser, base); if (file == NULL) return FALSE; - path = g_file_get_path (file); + input = g_file_read (file, NULL, &error); + if (input == NULL) + { + _gtk_css_parser_take_error (parser, error); + return FALSE; + } g_object_unref (file); - pixbuf = gdk_pixbuf_new_from_file (path, &error); - g_free (path); + pixbuf = gdk_pixbuf_new_from_stream (G_INPUT_STREAM (input), NULL, &error); + g_object_unref (input); + if (pixbuf == NULL) { _gtk_css_parser_take_error (parser, error); |