From: Andrea Zagli Date: Tue, 18 Aug 2015 21:21:00 +0000 (+0200) Subject: Added function ::get_soup_message. X-Git-Tag: v0.0.1~10 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=04302acad365fa39af906a486641726d8afcabb6;p=libgtkmapserver Added function ::get_soup_message. --- diff --git a/src/gtkmapserver.c b/src/gtkmapserver.c index a4e1422..a9b54c8 100644 --- a/src/gtkmapserver.c +++ b/src/gtkmapserver.c @@ -32,8 +32,6 @@ #include #endif -#include - #include "gtkmapserver.h" static void gtk_mapserver_class_init (GtkMapserverClass *klass); @@ -190,16 +188,16 @@ GtkWidget return gtk_mapserver; } -void -gtk_mapserver_set_home (GtkMapserver *gtkm, - const gchar *url) +SoupMessage +*gtk_mapserver_get_soup_message (GtkMapserver *gtkm, + const gchar *url) { - GError *error; SoupMessage *msg; - GdkPixbufLoader *pxb_loader; GtkMapserverPrivate *priv = GTK_MAPSERVER_GET_PRIVATE (gtkm); + msg = NULL; + msg = soup_message_new (SOUP_METHOD_GET, url); if (SOUP_IS_MESSAGE (msg)) { @@ -209,7 +207,27 @@ gtk_mapserver_set_home (GtkMapserver *gtkm, if (!SOUP_IS_MESSAGE (msg) || !SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) { - g_warning ("Error on retrieving url."); + g_warning ("Error on retrieving url: %s.", url); + msg = NULL; + } + + return msg; +} + +void +gtk_mapserver_set_home (GtkMapserver *gtkm, + const gchar *url) +{ + GError *error; + SoupMessage *msg; + GdkPixbufLoader *pxb_loader; + + GtkMapserverPrivate *priv = GTK_MAPSERVER_GET_PRIVATE (gtkm); + + msg = gtk_mapserver_get_soup_message (gtkm, url); + + if (msg == NULL) + { pxb_loader = NULL; } else @@ -337,3 +355,5 @@ gtk_mapserver_on_motion_notify_event (GtkWidget *widget, priv->sel_y_start = y; } } + +/* UTILS */ diff --git a/src/gtkmapserver.h b/src/gtkmapserver.h index 0d50cee..4d73727 100644 --- a/src/gtkmapserver.h +++ b/src/gtkmapserver.h @@ -27,7 +27,9 @@ #include #include #include + #include +#include G_BEGIN_DECLS @@ -59,6 +61,9 @@ GType gtk_mapserver_get_type (void) G_GNUC_CONST; GtkWidget *gtk_mapserver_new (void); +SoupMessage *gtk_mapserver_get_soup_message (GtkMapserver *gtkm, + const gchar *url); + void gtk_mapserver_set_home (GtkMapserver *gtkm, const gchar *url);