Load SVG files the deprecated way
authorRicardo Mones <ricardo@mones.org>
Sat, 28 Jan 2017 20:29:30 +0000 (21:29 +0100)
committerRicardo Mones <ricardo@mones.org>
Tue, 7 Feb 2017 19:02:58 +0000 (20:02 +0100)
src/stock_pixmap.c

index b401fa7..947b2e6 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <glib.h>
 #include <gtk/gtk.h>
 
 #include <glib.h>
 #include <gtk/gtk.h>
+#include <librsvg/rsvg.h>
 #include <string.h>
 #include <dirent.h>
 
 #include <string.h>
 #include <dirent.h>
 
@@ -468,6 +469,9 @@ static StockPixmapData pixmaps[] =
 static const char *extension[] = {
        ".png",
        ".xpm",
 static const char *extension[] = {
        ".png",
        ".xpm",
+#ifdef HAVE_SVG
+       ".svg",
+#endif
        NULL
 };
 
        NULL
 };
 
@@ -526,7 +530,15 @@ try_next_extension:
                                                             NULL);
                                if (is_file_exist(icon_file_name)) {
                                        GError *err = NULL;
                                                             NULL);
                                if (is_file_exist(icon_file_name)) {
                                        GError *err = NULL;
+#ifdef HAVE_SVG
+                                       if (!strncmp(extension[i], ".svg", 4)) {
+                                               pix = rsvg_pixbuf_from_file(icon_file_name, &err);
+                                       } else {
+                                               pix = gdk_pixbuf_new_from_file(icon_file_name, &err);
+                                       }
+#else
                                        pix = gdk_pixbuf_new_from_file(icon_file_name, &err);
                                        pix = gdk_pixbuf_new_from_file(icon_file_name, &err);
+#endif
                                        if (err) g_error_free(err);
                                }
                                if (pix) {
                                        if (err) g_error_free(err);
                                }
                                if (pix) {