]> saetta.ns0.it Git - libgtkmapserver/commitdiff
Added function ::get_gdk_pixbuf.
authorAndrea Zagli <andrea.zagli@email.it>
Tue, 18 Aug 2015 21:44:24 +0000 (23:44 +0200)
committerAndrea Zagli <andrea.zagli@email.it>
Tue, 18 Aug 2015 21:44:24 +0000 (23:44 +0200)
src/gtkmapserver.c
src/gtkmapserver.h

index ec33bf47b2681690bcf93b041f26138e3d13e8d4..997908d2601562751d25b211ab576c5a1cb34738 100644 (file)
@@ -227,19 +227,21 @@ SoupMessage
 }
 
 /**
- * gtk_mapserver_set_home:
+ * gtk_mapserver_get_extent:
  * @gtkm:
  * @url:
+ *
+ * Returns: a #GdkPibxbuf.
  */
-void
-gtk_mapserver_set_home (GtkMapserver *gtkm,
-                                               const gchar *url)
+GdkPixbuf
+*gtk_mapserver_get_gdk_pixbuf (GtkMapserver *gtkm, const gchar *url)
 {
+       GdkPixbuf *ret;
        GError *error;
        SoupMessage *msg;
        GdkPixbufLoader *pxb_loader;
 
-       GtkMapserverPrivate *priv = GTK_MAPSERVER_GET_PRIVATE (gtkm);
+       ret = NULL;
 
        msg = gtk_mapserver_get_soup_message (gtkm, url);
 
@@ -271,19 +273,31 @@ gtk_mapserver_set_home (GtkMapserver *gtkm,
                }
        if (pxb_loader != NULL)
                {
-                       g_object_set (G_OBJECT (priv->img),
-                                                 "pixbuf", gdk_pixbuf_loader_get_pixbuf (pxb_loader),
-                                                 NULL);
-
+                       ret = g_object_ref (gdk_pixbuf_loader_get_pixbuf (pxb_loader));
                        g_object_unref (pxb_loader);
-                       pxb_loader = NULL;
-               }
-       else
-               {
-                       g_object_set (G_OBJECT (priv->img),
-                                                 "pixbuf", NULL,
-                                                 NULL);
                }
+
+       return ret;
+}
+
+/**
+ * gtk_mapserver_set_home:
+ * @gtkm:
+ * @url:
+ */
+void
+gtk_mapserver_set_home (GtkMapserver *gtkm,
+                                               const gchar *url)
+{
+       GdkPixbuf *pixbuf;
+
+       GtkMapserverPrivate *priv = GTK_MAPSERVER_GET_PRIVATE (gtkm);
+
+       pixbuf = gtk_mapserver_get_gdk_pixbuf (gtkm, url);
+
+       g_object_set (G_OBJECT (priv->img),
+                                 "pixbuf", pixbuf,
+                                 NULL);
 }
 
 /**
index f5aa7dbad9f03caa8e7915204684e9b9d2a4f536..6cec3fab31861bdc8176e88457d2a0c4d19c954e 100644 (file)
@@ -64,6 +64,8 @@ GtkWidget *gtk_mapserver_new (void);
 SoupMessage *gtk_mapserver_get_soup_message (GtkMapserver *gtkm,
                                                                                         const gchar *url);
 
+GdkPixbuf *gtk_mapserver_get_gdk_pixbuf (GtkMapserver *gtkm, const gchar *url);
+
 void gtk_mapserver_set_home (GtkMapserver *gtkm, const gchar *url);
 
 typedef struct