Index: ChangeLog
===================================================================
--- ChangeLog	(revision 193)
+++ ChangeLog	(working copy)
@@ -1,3 +1,20 @@
+2008-04-20  Dan Winship  <danw@gnome.org>
+
+	* configure.in: require libsoup instead of gnome-vfs. (Also
+	require gconf explicitly; it used to be pulled in implicitly by
+	gnome-vfs.)
+
+	* libgweather/weather-bom.c:
+	* libgweather/weather-iwin.c:
+	* libgweather/weather-met.c:
+	* libgweather/weather-metar.c:
+	* libgweather/weather-wx.c: Use libsoup rather than gnome-vfs for
+	http. #527525
+
+	* libgweather/Makefile.am:
+	* libgweather/weather.c:
+	* libgweather/weather-priv.h: update for libsoup changes
+
 2008-04-20  Jaap A. Haitsma  <jaap@haitsma.org>
 
 	reviewed by: Vincent Untz
Index: configure.in
===================================================================
--- configure.in	(revision 193)
+++ configure.in	(working copy)
@@ -17,7 +17,7 @@ AC_SUBST(LT_VERSION)
 
 GTK_REQUIRED=2.11.0
 GLIB_REQUIRED=2.13.0
-GNOME_VFS_REQUIRED=2.15.4
+LIBSOUP_REQUIRED=2.4.0
 GCONF_REQUIRED=2.8.0
 LIBXML_REQUIRED=2.6.0
 
@@ -90,11 +90,17 @@ PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 
 AC_SUBST(LIBXML_FLAGS)
 AC_SUBST(LIBXML_LIBS)
 
-dnl -- check for gnome-vfs (optional) -----------------------------------------
-PKG_CHECK_MODULES(GNOME_VFS_APPLETS, 
-		  [gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED])
-AC_SUBST(GNOME_VFS_APPLETS_CFLAGS)
-AC_SUBST(GNOME_VFS_APPLETS_LIBS)
+dnl -- check for libsoup (required) -----------------------------------------
+PKG_CHECK_MODULES(LIBSOUP, 
+		  [libsoup-2.4 >= $LIBSOUP_REQUIRED])
+AC_SUBST(LIBSOUP_CFLAGS)
+AC_SUBST(LIBSOUP_LIBS)
+
+dnl -- check for gconf (required) -----------------------------------------
+PKG_CHECK_MODULES(GCONF, 
+		  [gconf-2.0 >= $GCONF_REQUIRED])
+AC_SUBST(GCONF_CFLAGS)
+AC_SUBST(GCONF_LIBS)
 
 AM_GCONF_SOURCE_2
 
Index: libgweather/weather.c
===================================================================
--- libgweather/weather.c	(revision 193)
+++ libgweather/weather.c	(working copy)
@@ -36,16 +36,11 @@
 #include <gtk/gtkicontheme.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <gdk-pixbuf/gdk-pixbuf-loader.h>
-#include <libgnomevfs/gnome-vfs.h>
 
 #define GWEATHER_I_KNOW_THIS_IS_UNSTABLE
 #include <libgweather/weather.h>
 #include "weather-priv.h"
 
-void
-close_cb (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer data);
-
-
 /*
  * Convert string of the form "DD-MM-SSH" to radians
  * DD:degrees (to 3 digits), MM:minutes, SS:seconds H:hemisphere (NESW)
@@ -298,60 +293,16 @@ gboolean requests_init (WeatherInfo *inf
     if (info->requests_pending)
         return FALSE;
 
-    /*g_assert(!metar_handle && !iwin_handle && !wx_handle && !met_handle);*/
-
-    info->requests_pending = TRUE;
-    	
     return TRUE;
 }
 
-void request_done (GnomeVFSAsyncHandle *handle, WeatherInfo *info)
-{
-    if (!handle)
-    	return;
-
-    gnome_vfs_async_close(handle, close_cb, info);
-
-    info->sunValid = info->valid && calc_sun(info);
-    return;
-}
-
-void requests_done_check (WeatherInfo *info)
+void request_done (WeatherInfo *info, gboolean ok)
 {
-    g_return_if_fail(info->requests_pending);
+    if (ok)
+	info->sunValid = info->valid && calc_sun(info);
 
-    if (!info->metar_handle && !info->iwin_handle && 
-        !info->wx_handle && !info->met_handle &&
-	!info->bom_handle) {
-        info->requests_pending = FALSE;
+    if (!--info->requests_pending)
         info->finish_cb(info, info->cb_data);
-    }
-}
-
-void
-close_cb (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer data)
-{
-	WeatherInfo *info = (WeatherInfo *)data;
-
-	g_return_if_fail (info != NULL);
-
-	if (result != GNOME_VFS_OK)
-		g_warning("Error closing GnomeVFSAsyncHandle.\n");
-	
-	if (handle == info->metar_handle)
-		info->metar_handle = NULL;
-	if (handle == info->iwin_handle)
-		info->iwin_handle = NULL;
-	if (handle == info->wx_handle)
-		info->wx_handle = NULL;
-	if (handle == info->met_handle)
-		info->met_handle = NULL;
-	if (handle == info->bom_handle)
-	        info->bom_handle = NULL;
- 	
-	requests_done_check(info);
-		
-	return;
 }
 
 /* Relative humidity computation - thanks to <Olof.Oberg@modopaper.modogroup.com> */
@@ -469,16 +420,7 @@ _weather_info_fill (WeatherInfo *info,
     /* FIXME: i'm not sure this works as intended anymore */
     if (!info) {
     	info = g_new0(WeatherInfo, 1);
-        info->metar_handle = NULL;
-    	info->iwin_handle = NULL;
-    	info->wx_handle = NULL;
-    	info->met_handle = NULL;
-        info->bom_handle = NULL;
-    	info->requests_pending = FALSE;
-    	info->metar_buffer = NULL;
-        info->iwin_buffer = NULL;
-		info->met_buffer = NULL;
-		info->bom_buffer = NULL;
+    	info->requests_pending = 0;
     	info->location = weather_location_clone(location);
     } else {
         location = info->location;
@@ -525,52 +467,31 @@ _weather_info_fill (WeatherInfo *info,
     info->radar = NULL;
     info->radar_url = prefs->radar && prefs->radar_custom_url ?
     		      g_strdup (prefs->radar_custom_url) : NULL;
-    info->metar_handle = NULL;
-    info->iwin_handle = NULL;
-    info->wx_handle = NULL;
-    info->met_handle = NULL;
-    info->bom_handle = NULL;
-    info->requests_pending = TRUE;
     info->finish_cb = cb;
     info->cb_data = data;
 
+    if (!info->session)
+	info->session = soup_session_async_new ();
+
     metar_start_open(info);
+    info->requests_pending++;
     iwin_start_open(info);
+    info->requests_pending++;
 
-    if (prefs->radar)
+    if (prefs->radar) {
         wx_start_open(info);
+	info->requests_pending++;
+    }
 
     return info;
 }
 
 void weather_info_abort (WeatherInfo *info)
 {
-    if (info->metar_handle) {
-       gnome_vfs_async_cancel(info->metar_handle);
-       info->metar_handle = NULL;
-    }
-
-    if (info->iwin_handle) {
-       gnome_vfs_async_cancel(info->iwin_handle);
-       info->iwin_handle = NULL;
-    }
-
-    if (info->wx_handle) {
-       gnome_vfs_async_cancel(info->wx_handle);
-       info->wx_handle = NULL;
-    }
-
-    if (info->met_handle) {
-       gnome_vfs_async_cancel(info->met_handle);
-       info->met_handle = NULL;
+    if (info->session) {
+	soup_session_abort (info->session);
+	info->requests_pending = 0;
     }
-
-    if (info->bom_handle) {
-       gnome_vfs_async_cancel(info->bom_handle);
-       info->bom_handle = NULL;
-    }
-
-    info->requests_pending = FALSE;
 }
 
 WeatherInfo *weather_info_clone (const WeatherInfo *info)
@@ -605,6 +526,8 @@ void weather_info_free (WeatherInfo *inf
         return;
 
     weather_info_abort (info);
+    if (info->session)
+	g_object_unref (info->session);
 
     weather_location_free(info->location);
     info->location = NULL;
@@ -617,18 +540,6 @@ void weather_info_free (WeatherInfo *inf
         info->radar = NULL;
     }
 	
-	if (info->iwin_buffer)
-	    g_free (info->iwin_buffer);
-
-	if (info->metar_buffer)	
-	    g_free (info->metar_buffer);
-
-    if (info->met_buffer)
-        g_free (info->met_buffer);
-
-    if (info->bom_buffer)
-        g_free (info->bom_buffer);
-
     g_free(info);
 }
 
Index: libgweather/weather-iwin.c
===================================================================
--- libgweather/weather-iwin.c	(revision 193)
+++ libgweather/weather-iwin.c	(working copy)
@@ -25,14 +25,8 @@
 #include <libgweather/weather.h>
 #include "weather-priv.h"
 
-#define IWIN_RE_STR "([A-Z][A-Z]Z(([0-9]{3}>[0-9]{3}-)|([0-9]{3}-))+)+([0-9]{6}-)?"
-
-/**
- * Unused. Are these functions useful?
- */
-
 /**
- *  Human's don't deal well with .MONDAY...SUNNY AND BLAH BLAH.TUESDAY...THEN THIS AND THAT.WEDNESDAY...RAINY BLAH BLAH.
+ *  Humans don't deal well with .MONDAY...SUNNY AND BLAH BLAH.TUESDAY...THEN THIS AND THAT.WEDNESDAY...RAINY BLAH BLAH.
  *  This function makes it easier to read.
  */
 static gchar* formatWeatherMsg (gchar* forecast) {
@@ -71,85 +65,22 @@ static gchar* formatWeatherMsg (gchar* f
     return forecast;
 }
 
-
-static void iwin_finish_read(GnomeVFSAsyncHandle *handle, GnomeVFSResult result, 
-			     gpointer buffer, GnomeVFSFileSize requested, 
-			     GnomeVFSFileSize body_len, gpointer data)
+static void iwin_finish (SoupSession *session, SoupMessage *msg, gpointer data)
 {
     WeatherInfo *info = (WeatherInfo *)data;
-    gchar *body, *temp;
-    
-    g_return_if_fail(info != NULL);
-    g_return_if_fail(handle == info->iwin_handle);
-
-    info->forecast = NULL;
-    body = (gchar *)buffer;
-    body[body_len] = '\0';
-
-    if (info->iwin_buffer == NULL)
-	info->iwin_buffer = g_strdup(body);
-    else
-    {
-	temp = g_strdup(info->iwin_buffer);
-	g_free(info->iwin_buffer);
-	info->iwin_buffer = g_strdup_printf("%s%s", temp, body);
-	g_free(temp);
-    }
-	
-    if (result == GNOME_VFS_ERROR_EOF)
-    {
-        info->forecast = formatWeatherMsg(g_strdup (info->iwin_buffer));
-    }
-    else if (result != GNOME_VFS_OK) {
-	g_print("%s", gnome_vfs_result_to_string(result));
-        g_warning("Failed to get IWIN data.\n");
-    } else {
-        gnome_vfs_async_read(handle, body, DATA_SIZE - 1, iwin_finish_read, info);
-        return;
-    }
-    
-    request_done(info->iwin_handle, info);
-    g_free (buffer);
-    return;
-}
-
-static void iwin_finish_open (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer data)
-{
-    WeatherInfo *info = (WeatherInfo *)data;
-    WeatherLocation *loc;
-    gchar *body;
 
     g_return_if_fail(info != NULL);
-    g_return_if_fail(handle == info->iwin_handle);
 
-    body = g_malloc0(DATA_SIZE);
-
-    if (info->iwin_buffer)
-    	g_free (info->iwin_buffer);
-    info->iwin_buffer = NULL;	
-    if (info->forecast)
-    g_free (info->forecast);
-    info->forecast = NULL;
-    loc = info->location;
-    if (loc == NULL) {
-	    g_warning (_("WeatherInfo missing location"));
-	    request_done(info->iwin_handle, info);
-	    info->iwin_handle = NULL;
-	    requests_done_check(info);
-	    g_free (body);
-	    return;
-    }
-
-    if (result != GNOME_VFS_OK) {
+    if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) {
         /* forecast data is not really interesting anyway ;) */
-	  g_warning("Failed to get IWIN forecast data.\n"); 
-        info->iwin_handle = NULL;
-        requests_done_check (info);
-        g_free (body);
-    } else {
-        gnome_vfs_async_read(handle, body, DATA_SIZE - 1, iwin_finish_read, info);
+	g_warning("Failed to get IWIN forecast data: %d %s\n",
+		  msg->status_code, msg->reason_phrase); 
+        request_done(info, FALSE);
+	return;
     }
-    return;
+
+    info->forecast = formatWeatherMsg(g_strdup (msg->response_body->data));
+    request_done(info, TRUE);
 }
 
 /* Get forecast into newly alloc'ed string */
@@ -157,6 +88,7 @@ void iwin_start_open (WeatherInfo *info)
 {
     gchar *url, *state, *zone;
     WeatherLocation *loc;
+    SoupMessage *msg;
 
     g_return_if_fail(info != NULL);
     loc = info->location;
@@ -165,6 +97,11 @@ void iwin_start_open (WeatherInfo *info)
     if (loc->zone[0] == '-')
         return;
         
+    if (info->forecast) {
+	g_free (info->forecast);
+	info->forecast = NULL;
+    }
+
     if (loc->zone[0] == ':')	/* Met Office Region Names */
     {
     	metoffice_start_open (info);
@@ -197,9 +134,7 @@ void iwin_start_open (WeatherInfo *info)
     g_free (zone);   
     g_free (state);
 
-    gnome_vfs_async_open(&info->iwin_handle, url, GNOME_VFS_OPEN_READ, 
-    			 0, iwin_finish_open, info);
+    msg = soup_message_new ("GET", url);
     g_free(url);
-
+    soup_session_queue_message (info->session, msg, iwin_finish, info);
 }
-
Index: libgweather/weather-metar.c
===================================================================
--- libgweather/weather-metar.c	(revision 193)
+++ libgweather/weather-metar.c	(working copy)
@@ -473,107 +473,48 @@ gboolean metar_parse (gchar *metar, Weat
     return TRUE;
 }
 
-static void metar_finish_read(GnomeVFSAsyncHandle *handle, GnomeVFSResult result, 
-			      gpointer buffer, GnomeVFSFileSize requested, 
-			      GnomeVFSFileSize body_len, gpointer data)
+static void metar_finish (SoupSession *session, SoupMessage *msg, gpointer data)
 {
     WeatherInfo *info = (WeatherInfo *)data;
     WeatherLocation *loc;
-    gchar *metar, *eoln, *body, *temp;
+    const gchar *p, *eoln;
+    gchar *searchkey, *metar;
     gboolean success = FALSE;
-    gchar *searchkey;
 
     g_return_if_fail(info != NULL);
-    g_return_if_fail(handle == info->metar_handle);
-	
-    loc = info->location;
-    body = (gchar *)buffer;
-
-    body[body_len] = '\0';
 
-    if (info->metar_buffer == NULL)
-    	info->metar_buffer = g_strdup(body);
-    else
-    {
-	temp = g_strdup(info->metar_buffer);
-	g_free(info->metar_buffer);
-	info->metar_buffer = g_strdup_printf("%s%s", temp, body);
-	g_free(temp);
-    }
-		
-    if (result == GNOME_VFS_ERROR_EOF)
-    {
-
-        searchkey = g_strdup_printf("\n%s", loc->code);
-
-        metar = strstr(info->metar_buffer, searchkey);
-        g_free (searchkey);
-        if (metar == NULL) {
-            success = FALSE;
-        } else {
-            metar += WEATHER_LOCATION_CODE_LEN + 2;
-            eoln = strchr(metar, '\n');
-	    if (eoln != NULL)
-		    *eoln = 0;
-            success = metar_parse(metar, info);
-	    if (eoln != NULL)
-		    *eoln = '\n';
-        }
-
-        info->valid = success;
-    }
-    else if (result != GNOME_VFS_OK) {
-	g_print("%s", gnome_vfs_result_to_string(result));
-        g_warning(_("Failed to get METAR data.\n"));
-    } else {
-	 gnome_vfs_async_read(handle, body, DATA_SIZE - 1, metar_finish_read, info);
-	 return;      
+    if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
+        g_warning(_("Failed to get METAR data: %d %s.\n"),
+		  msg->status_code, msg->reason_phrase);
+	request_done(info, FALSE); 
+	return;
     }
-    
-    request_done(info->metar_handle, info);
-    g_free (buffer);
-    return;
-}
-
-static void metar_finish_open (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer data)
-{
-    WeatherInfo *info = (WeatherInfo *)data;
-    WeatherLocation *loc;
-    gchar *body;
-
-    g_return_if_fail(info != NULL);
-    g_return_if_fail(handle == info->metar_handle);
 
-    body = g_malloc0(DATA_SIZE);
-    
-    if (info->metar_buffer)
-    	g_free (info->metar_buffer);
-    info->metar_buffer = NULL;
     loc = info->location;
-    if (loc == NULL) {
-	    g_warning (_("WeatherInfo missing location"));
-	    request_done(info->metar_handle, info);
-	    requests_done_check(info);
-	    g_free (body);
-	    return;
-    }
 
-    if (result != GNOME_VFS_OK) {
-        g_warning(_("Failed to get METAR data.\n"));
-        info->metar_handle = NULL;
-	requests_done_check(info); 
-	g_free (body);
-    } else {
-        gnome_vfs_async_read(handle, body, DATA_SIZE - 1, metar_finish_read, info);
+    searchkey = g_strdup_printf("\n%s", loc->code);
+    p = strstr(msg->response_body->data, searchkey);
+    g_free (searchkey);
+    if (p) {
+	p += WEATHER_LOCATION_CODE_LEN + 2;
+	eoln = strchr(p, '\n');
+	if (eoln)
+	    metar = g_strndup (p, eoln - p);
+	else
+	    metar = g_strdup (p);
+	success = metar_parse(metar, info);
+	g_free (metar);
     }
-    return;
+
+    info->valid = success;
+    request_done(info, TRUE);
 }
 
 /* Read current conditions and fill in info structure */
 void metar_start_open (WeatherInfo *info)
 {
-    gchar *url;
     WeatherLocation *loc;
+    SoupMessage *msg;
 
     g_return_if_fail(info != NULL);
     info->valid = FALSE;
@@ -583,9 +524,9 @@ void metar_start_open (WeatherInfo *info
 	    return;
     }
 
-    url = g_strdup_printf("http://weather.noaa.gov/cgi-bin/mgetmetar.pl?cccc=%s", loc->code);
-    gnome_vfs_async_open(&info->metar_handle, url, GNOME_VFS_OPEN_READ, 
-    		         0, metar_finish_open, info);
-    g_free(url);
-
+    msg = soup_form_request_new(
+	"GET", "http://weather.noaa.gov/cgi-bin/mgetmetar.pl",
+	"cccc", loc->code,
+	NULL);
+    soup_session_queue_message(info->session, msg, metar_finish, info);
 }
Index: libgweather/weather-bom.c
===================================================================
--- libgweather/weather-bom.c	(revision 193)
+++ libgweather/weather-bom.c	(working copy)
@@ -19,7 +19,7 @@
 #include <libgweather/weather.h>
 #include "weather-priv.h"
 
-static gchar *bom_parse (gchar *meto)
+static gchar *bom_parse (const gchar *meto)
 { 
     gchar *p, *rp;
 
@@ -36,90 +36,36 @@ static gchar *bom_parse (gchar *meto)
     return g_strndup(p, rp-p);
 }
 
-static void bom_finish_read(GnomeVFSAsyncHandle *handle, GnomeVFSResult result, 
-			    gpointer buffer, GnomeVFSFileSize requested, 
-			    GnomeVFSFileSize body_len, gpointer data)
+static void bom_finish (SoupSession *session, SoupMessage *msg, gpointer data)
 {
     WeatherInfo *info = (WeatherInfo *)data;
-    gchar *body, *forecast, *temp;
 
     g_return_if_fail(info != NULL);
-    g_return_if_fail(handle == info->bom_handle);
-
-    info->forecast = NULL;
-    body = (gchar *)buffer;
-    body[body_len] = '\0';
-	
-    if (info->bom_buffer == NULL)
-        info->bom_buffer = g_strdup(body);
-    else
-    {
-        temp = g_strdup(info->bom_buffer);
-	g_free(info->bom_buffer);
-	info->bom_buffer = g_strdup_printf("%s%s", temp, body);
-	g_free(temp);
-    }
-	
-    if (result == GNOME_VFS_ERROR_EOF)
-    {
-	forecast = bom_parse(info->bom_buffer);
-        info->forecast = forecast;
-    }
-    else if (result != GNOME_VFS_OK) {
-	info->bom_handle = NULL;
-	requests_done_check (info);
-        g_warning("Failed to get BOM data.\n");
-    } else {
-	gnome_vfs_async_read(handle, body, DATA_SIZE - 1, bom_finish_read, info);
 
+    if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
+        g_warning("Failed to get BOM forecast data: %d %s.\n",
+		  msg->status_code, msg->reason_phrase);
+        request_done(info, FALSE);
 	return;
     }
-    
-    request_done(info->bom_handle, info);
-    g_free (buffer);
-    return;
-}
 
-static void bom_finish_open (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer data)
-{
-    WeatherInfo *info = (WeatherInfo *)data;
-    WeatherLocation *loc;
-    gchar *body;
-
-    g_return_if_fail(info != NULL);
-    g_return_if_fail(handle == info->bom_handle);
-
-    body = g_malloc0(DATA_SIZE);
-
-    info->bom_buffer = NULL;
-    if (info->forecast)
-    	g_free (info->forecast);	
-    info->forecast = NULL;
-    loc = info->location;
-    g_return_if_fail(loc != NULL);
-
-    if (result != GNOME_VFS_OK) {
-        g_warning("Failed to get BOM forecast data.\n");
-        info->bom_handle = NULL;
-        requests_done_check (info);
-        g_free (body);
-    } else {
-    	gnome_vfs_async_read(handle, body, DATA_SIZE - 1, bom_finish_read, info);
-    }
+    info->forecast = bom_parse(msg->response_body->data);
+    request_done(info, TRUE);
     return;
 }
 
 void bom_start_open (WeatherInfo *info)
 {
     gchar *url;
+    SoupMessage *msg;
     WeatherLocation *loc;
+
     loc = info->location;
-  
     url = g_strdup_printf("http://www.bom.gov.au/cgi-bin/wrap_fwo.pl?%s.txt",
 			  loc->zone+1);
 
-    gnome_vfs_async_open(&info->bom_handle, url, GNOME_VFS_OPEN_READ, 
-    			 0, bom_finish_open, info);
+    msg = soup_message_new("GET", url);
+    soup_session_queue_message(info->session, msg, bom_finish, info);
     g_free(url);
 
     return;
Index: libgweather/weather-met.c
===================================================================
--- libgweather/weather-met.c	(revision 193)
+++ libgweather/weather-met.c	(working copy)
@@ -124,7 +124,7 @@ static char *met_reprocess(char *x, int 
  * be done with this ;) 
  */
 
-static gchar *met_parse (gchar *meto)
+static gchar *met_parse (const gchar *meto)
 { 
     gchar *p;
     gchar *rp;
@@ -147,91 +147,35 @@ static gchar *met_parse (gchar *meto)
     return t;
 }
 
-static void met_finish_read(GnomeVFSAsyncHandle *handle, GnomeVFSResult result, 
-			    gpointer buffer, GnomeVFSFileSize requested, 
-			    GnomeVFSFileSize body_len, gpointer data)
+static void met_finish (SoupSession *session, SoupMessage *msg, gpointer data)
 {
     WeatherInfo *info = (WeatherInfo *)data;
-    WeatherLocation *loc;
-    gchar *body, *forecast, *temp;
 
     g_return_if_fail(info != NULL);
-    g_return_if_fail(handle == info->met_handle);
-
-    info->forecast = NULL;
-    loc = info->location;
-    body = (gchar *)buffer;
-    body[body_len] = '\0';
 
-    if (info->met_buffer == NULL)
-        info->met_buffer = g_strdup(body);
-    else
-    {
-        temp = g_strdup(info->met_buffer);
-	g_free(info->met_buffer);
-	info->met_buffer = g_strdup_printf("%s%s", temp, body);
-	g_free(temp);
-    }
-	
-    if (result == GNOME_VFS_ERROR_EOF)
-    {
-	forecast = met_parse(info->met_buffer);
-        info->forecast = forecast;
-    }
-    else if (result != GNOME_VFS_OK) {
-	g_print("%s", gnome_vfs_result_to_string(result));
-	info->met_handle = NULL;
-	requests_done_check (info);
-        g_warning("Failed to get Met Office data.\n");
-    } else {
-        gnome_vfs_async_read(handle, body, DATA_SIZE - 1, met_finish_read, info);
+    if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
+	g_warning("Failed to get Met Office forecast data: %d %s.\n",
+		  msg->status_code, msg->reason_phrase);
+        request_done(info, FALSE);
         return;
     }
-    
-    request_done(info->met_handle, info);
-    g_free (buffer);
-    return;
-}
-
-static void met_finish_open (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer data)
-{
-    WeatherInfo *info = (WeatherInfo *)data;
-    WeatherLocation *loc;
-    gchar *body;
-
-    g_return_if_fail(info != NULL);
-    g_return_if_fail(handle == info->met_handle);
-
-    body = g_malloc0(DATA_SIZE);
 
-    info->met_buffer = NULL;
-    if (info->forecast)
-    	g_free (info->forecast);	
-    info->forecast = NULL;
-    loc = info->location;
-    g_return_if_fail(loc != NULL);
-
-    if (result != GNOME_VFS_OK) {
-        g_warning("Failed to get Met Office forecast data.\n");
-        info->met_handle = NULL;
-        requests_done_check (info);
-        g_free (body);
-    } else {
-    	gnome_vfs_async_read(handle, body, DATA_SIZE - 1, met_finish_read, info);
-    }
+    info->forecast = met_parse(msg->response_body->data);
+    request_done(info, TRUE);
     return;
 }
 
 void metoffice_start_open (WeatherInfo *info)
 {
     gchar *url;
+    SoupMessage *msg;
     WeatherLocation *loc;
+
     loc = info->location;
-  
     url = g_strdup_printf("http://www.metoffice.gov.uk/weather/europe/uk/%s.html", loc->zone+1);
 
-    gnome_vfs_async_open(&info->met_handle, url, GNOME_VFS_OPEN_READ, 
-    			 0, met_finish_open, info);
+    msg = soup_message_new("GET", url);
+    soup_session_queue_message(info->session, msg, met_finish, info);
     g_free(url);
 
     return;
Index: libgweather/weather-priv.h
===================================================================
--- libgweather/weather-priv.h	(revision 193)
+++ libgweather/weather-priv.h	(working copy)
@@ -12,7 +12,7 @@
 #define __WEATHER_PRIV_H_
 
 #include <time.h>
-#include <libgnomevfs/gnome-vfs.h>
+#include <libsoup/soup.h>
 
 #include "weather.h"
 
@@ -131,20 +131,12 @@ struct _WeatherInfo {
     WeatherUpdate sunrise;
     WeatherUpdate sunset;
     gchar *forecast;
-    gchar *metar_buffer;
-    gchar *iwin_buffer;
-    gchar *met_buffer;
-    gchar *bom_buffer;
     gchar *radar_buffer;
     gchar *radar_url;
     GdkPixbufLoader *radar_loader;
     GdkPixbufAnimation *radar;
-    GnomeVFSAsyncHandle *metar_handle;
-    GnomeVFSAsyncHandle *iwin_handle;
-    GnomeVFSAsyncHandle *wx_handle;
-    GnomeVFSAsyncHandle *met_handle;
-    GnomeVFSAsyncHandle *bom_handle;
-    gboolean requests_pending;
+    SoupSession *session;
+    gint requests_pending;
 
     WeatherInfoFunc finish_cb;
     gpointer cb_data;
@@ -201,9 +193,8 @@ gboolean	metar_parse		(gchar *metar,
 					 WeatherInfo *info);
 
 gboolean	requests_init		(WeatherInfo *info);
-void		request_done		(GnomeVFSAsyncHandle *handle,
-					 WeatherInfo *info);
-void		requests_done_check	(WeatherInfo *info);
+void		request_done		(WeatherInfo *info,
+					 gboolean     ok);
 
 gboolean	calc_sun		(WeatherInfo *info);
 
Index: libgweather/Makefile.am
===================================================================
--- libgweather/Makefile.am	(revision 193)
+++ libgweather/Makefile.am	(working copy)
@@ -21,7 +21,8 @@ libgweather_la_CFLAGS = \
 	$(WARN_CFLAGS)			\
 	$(GTK_CFLAGS)			\
 	$(LIBXML_CFLAGS)		\
-	$(GNOME_VFS_APPLETS_CFLAGS)	\
+	$(LIBSOUP_CFLAGS)		\
+	$(GCONF_CFLAGS)			\
 	-DG_LOG_DOMAIN=\"GWeather\"	\
 	-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
 	-DGWEATHER_XML_LOCATION_DIR=\""$(pkgdatadir)"\"
@@ -29,7 +30,8 @@ libgweather_la_CFLAGS = \
 libgweather_la_LIBADD = \
 	$(GTK_LIBS)	\
 	$(LIBXML_LIBS)	\
-	$(GNOME_VFS_APPLETS_LIBS)
+	$(LIBSOUP_LIBS)	\
+	$(GCONF_LIBS)
 
 libgweather_la_LDFLAGS = \
 	-version-info $(LT_VERSION) -no-undefined
@@ -41,11 +43,11 @@ test_metar_CFLAGS = \
 	-I$(srcdir)			\
 	$(WARN_CFLAGS)			\
 	$(GTK_CFLAGS)			\
-	$(GNOME_VFS_APPLETS_CFLAGS)	\
+	$(LIBSOUP_CFLAGS)		\
 	-DG_LOG_DOMAIN=\"GWeather\"
 
 test_metar_LDADD = \
-	$(GNOME_VFS_APPLETS_LIB) \
+	$(LIBSOUP_LIBS)	\
 	libgweather.la
 
 noinst_HEADERS = weather-priv.h
Index: libgweather/gweather.pc.in
===================================================================
--- libgweather/gweather.pc.in	(revision 193)
+++ libgweather/gweather.pc.in	(working copy)
@@ -8,6 +8,6 @@ Name: GWeather
 Description: GWeather shared library
 Version: @VERSION@
 Requires: glib-2.0 gobject-2.0 gdk-pixbuf-2.0 gtk+-2.0 gconf-2.0
-Requires.private: libxml-2.0 gnome-vfs-2.0
+Requires.private: libxml-2.0 libsoup-2.4
 Libs: -L${libdir} -lgweather -lm
 Cflags: -I${includedir}
Index: libgweather/weather-wx.c
===================================================================
--- libgweather/weather-wx.c	(revision 193)
+++ libgweather/weather-wx.c	(working copy)
@@ -20,89 +20,54 @@
 #include <libgweather/weather.h>
 #include "weather-priv.h"
 
-static void wx_finish_read(GnomeVFSAsyncHandle *handle, GnomeVFSResult result, 
-			   gpointer buffer, GnomeVFSFileSize requested, 
-			   GnomeVFSFileSize body_len, gpointer data)
+static void wx_finish (SoupSession *session, SoupMessage *msg, gpointer data)
 {
     WeatherInfo *info = (WeatherInfo *)data;
+    GdkPixbufAnimation *animation;
 
     g_return_if_fail(info != NULL);
-    g_return_if_fail(handle == info->wx_handle);
 
-    info->radar = NULL;
-
-    if (result == GNOME_VFS_OK && body_len != 0) {
-        GError *error = NULL;
-    	gdk_pixbuf_loader_write (info->radar_loader, buffer, body_len, &error);
-        if (error) {
-            g_print ("%s \n", error->message);
-            g_error_free (error);
-        }
-        gnome_vfs_async_read(handle, buffer, DATA_SIZE - 1, wx_finish_read, info);
-        return;
+    if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
+	g_warning("Failed to get radar map image: %d %s.\n",
+		  msg->status_code, msg->reason_phrase);
+	g_object_unref (info->radar_loader);
+	request_done (info, FALSE);
+	return;
     }
-    else if (result == GNOME_VFS_ERROR_EOF)
-    {
-        GdkPixbufAnimation *animation;
-    	
-        gdk_pixbuf_loader_close (info->radar_loader, NULL);
-        animation = gdk_pixbuf_loader_get_animation (info->radar_loader);
-	if (animation != NULL)
-	{
-            if (info->radar)
-                g_object_unref (info->radar);
-	    info->radar = animation;
-	    g_object_ref (info->radar);
-        }
-	g_object_unref (G_OBJECT (info->radar_loader));
-        
-    }
-    else
-    {
-        g_print("%s", gnome_vfs_result_to_string(result));
-        g_warning(_("Failed to get METAR data.\n"));
-        info->wx_handle = NULL;
-        requests_done_check (info);
-	if(info->radar_loader)  g_object_unref (G_OBJECT (info->radar_loader));
+
+    gdk_pixbuf_loader_close (info->radar_loader, NULL);
+    animation = gdk_pixbuf_loader_get_animation (info->radar_loader);
+    if (animation != NULL) {
+	if (info->radar)
+	    g_object_unref (info->radar);
+	info->radar = animation;
+	g_object_ref (info->radar);
     }
-    
-    request_done(info->wx_handle, info);
-    g_free (buffer);    
-    return;
+    g_object_unref (info->radar_loader);
+
+    request_done(info, TRUE);
 }
 
-static void wx_finish_open (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer data)
+static void wx_got_chunk (SoupMessage *msg, SoupBuffer *chunk, gpointer data)
 {
     WeatherInfo *info = (WeatherInfo *)data;
-    WeatherLocation *loc;
-    gchar *body;
+    GError *error = NULL;
 
     g_return_if_fail(info != NULL);
-    g_return_if_fail(handle == info->wx_handle);
-
-    body = g_malloc0(DATA_SIZE);
 
-    info->radar_buffer = NULL;
-    info->radar = NULL;
-    loc = info->location;
-    g_return_if_fail(loc != NULL);
-
-    if (result != GNOME_VFS_OK) {
-        g_warning("Failed to get radar map image.\n");
-        info->wx_handle = NULL;
-        requests_done_check (info);
-        g_free (body);
-    } else {
-        gnome_vfs_async_read(handle, body, DATA_SIZE -1, wx_finish_read, info); 
-    	
+    gdk_pixbuf_loader_write (info->radar_loader, (guchar *)chunk->data,
+			     chunk->length, &error);
+    if (error) {
+	g_print ("%s \n", error->message);
+	g_error_free (error);
     }
-     return;
 }
 
 /* Get radar map and into newly allocated pixmap */
 void wx_start_open (WeatherInfo *info)
 {
     gchar *url;
+    SoupMessage *msg;
     WeatherLocation *loc;
     
     g_return_if_fail(info != NULL);
@@ -110,18 +75,18 @@ void wx_start_open (WeatherInfo *info)
     info->radar_loader = gdk_pixbuf_loader_new ();
     loc = info->location;
     g_return_if_fail(loc != NULL);
-
     
     if (info->radar_url)
-    	url = g_strdup (info->radar_url);
+	url = g_strdup (info->radar_url);
     else {
-    	 if (loc->radar[0] == '-') return;
-	 url = g_strdup_printf ("http://image.weather.com/web/radar/us_%s_closeradar_medium_usen.jpg", loc->radar);
+	if (loc->radar[0] == '-') return;
+	url = g_strdup_printf ("http://image.weather.com/web/radar/us_%s_closeradar_medium_usen.jpg", loc->radar);
     }
  
-    gnome_vfs_async_open(&info->wx_handle, url, GNOME_VFS_OPEN_READ, 
-    			 0, wx_finish_open, info);
-    				 
+    msg = soup_message_new("GET", url);
+    g_signal_connect(msg, "got-chunk", G_CALLBACK (wx_got_chunk), info);
+    soup_message_set_flags(msg, SOUP_MESSAGE_OVERWRITE_CHUNKS);
+    soup_session_queue_message(info->session, msg, wx_finish, info);
     g_free(url);
 
     return;
