From: Andrea Zagli Date: Tue, 18 Aug 2015 21:44:24 +0000 (+0200) Subject: Added function ::get_gdk_pixbuf. X-Git-Tag: v0.0.1~8 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=1506c99287d79de0ba6d28744f16d4ee85de898b;p=libgtkmapserver Added function ::get_gdk_pixbuf. --- diff --git a/src/gtkmapserver.c b/src/gtkmapserver.c index ec33bf4..997908d 100644 --- a/src/gtkmapserver.c +++ b/src/gtkmapserver.c @@ -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); } /** diff --git a/src/gtkmapserver.h b/src/gtkmapserver.h index f5aa7db..6cec3fa 100644 --- a/src/gtkmapserver.h +++ b/src/gtkmapserver.h @@ -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