Lines 18-23
Link Here
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 |
*/ |
19 |
*/ |
20 |
|
20 |
|
|
|
21 |
#include <gio/gio.h> |
21 |
#include <gtk/gtk.h> |
22 |
#include <gtk/gtk.h> |
22 |
#include <librsvg/rsvg.h> |
23 |
#include <librsvg/rsvg.h> |
23 |
|
24 |
|
Lines 30-36
Link Here
|
30 |
{ |
31 |
{ |
31 |
gchar *full_pathname; |
32 |
gchar *full_pathname; |
32 |
GdkPixbuf *pixbuf = NULL; |
33 |
GdkPixbuf *pixbuf = NULL; |
33 |
GError *error; |
34 |
GError *error = NULL; |
|
|
35 |
GFile *file; |
34 |
|
36 |
|
35 |
full_pathname = g_strconcat(DATADIR "/pixmaps/", |
37 |
full_pathname = g_strconcat(DATADIR "/pixmaps/", |
36 |
filename, |
38 |
filename, |
Lines 38-50
Link Here
|
38 |
if (g_file_test(full_pathname, G_FILE_TEST_IS_REGULAR)) { |
40 |
if (g_file_test(full_pathname, G_FILE_TEST_IS_REGULAR)) { |
39 |
pixbuf = rsvg_pixbuf_from_file_at_size (full_pathname, width, |
41 |
pixbuf = rsvg_pixbuf_from_file_at_size (full_pathname, width, |
40 |
height, &error); |
42 |
height, &error); |
41 |
g_free (full_pathname); |
43 |
if (pixbuf == NULL) { |
|
|
44 |
// Some versions of librsvg need URI instead of path. |
45 |
// https://gitlab.gnome.org/GNOME/librsvg/issues/198 |
46 |
g_clear_error (&error); |
47 |
file = g_file_new_for_path (full_pathname); |
48 |
g_free (full_pathname); |
49 |
full_pathname = g_file_get_uri (file); |
50 |
g_object_unref (file); |
51 |
pixbuf = rsvg_pixbuf_from_file_at_size (full_pathname, width, |
52 |
height, &error); |
53 |
} |
42 |
if (pixbuf == NULL) |
54 |
if (pixbuf == NULL) |
43 |
g_free (error); |
55 |
g_error_free (error); |
44 |
|
56 |
|
45 |
} else |
57 |
} else |
46 |
g_warning ("%s not found", filename); |
58 |
g_warning ("%s not found", filename); |
47 |
|
59 |
|
|
|
60 |
g_free (full_pathname); |
61 |
|
48 |
return pixbuf; |
62 |
return pixbuf; |
49 |
} |
63 |
} |
50 |
|
64 |
|