Add another symbolic pixbuf helper
authorMatthias Clasen <mclasen@redhat.com>
Fri, 18 Oct 2019 12:46:52 +0000 (07:46 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 18 Oct 2019 13:53:23 +0000 (08:53 -0500)
gtk/gdkpixbufutilsprivate.h
gtk/tools/gdkpixbufutils.c

index 592bc9ea59d2835a2b65715573bb7a2c70e9fe3c..bd6125ea5240b531b3a611a2d5d3c85750f1b95b 100644 (file)
@@ -63,6 +63,11 @@ GdkPixbuf *gtk_make_symbolic_pixbuf_from_file     (GFile         *file,
                                                    int            height,
                                                    double         scale,
                                                    GError       **error);
+GdkPixbuf *gtk_make_symbolic_pixbuf_from_path     (const char    *path,
+                                                   int            width,
+                                                   int            height,
+                                                   double         scale,
+                                                   GError       **error);
 GdkPixbuf *gtk_make_symbolic_pixbuf_from_resource (const char    *path,
                                                    int            width,
                                                    int            height,
index a572f48a82d54b2c332b9a536886d6c0b7e12306..ae2684adb2be3195913d39db947f832658f350b0 100644 (file)
@@ -425,6 +425,27 @@ gtk_make_symbolic_pixbuf_from_resource (const char  *path,
   return pixbuf;
 }
 
+GdkPixbuf *
+gtk_make_symbolic_pixbuf_from_path (const char  *path,
+                                    int          width,
+                                    int          height,
+                                    double       scale,
+                                    GError     **error)
+{
+  char *data;
+  gsize size;
+  GdkPixbuf *pixbuf;
+
+  if (!g_file_get_contents (path, &data, &size, error))
+    return NULL;
+
+  pixbuf = gtk_make_symbolic_pixbuf_from_data (data, size, width, height, scale, error);
+
+  g_free (data);
+
+  return pixbuf;
+}
+
 GdkPixbuf *
 gtk_make_symbolic_pixbuf_from_file (GFile       *file,
                                     int          width,