libgweather r512 - in trunk: . libgweather



Author: danw
Date: Tue Nov 25 16:33:16 2008
New Revision: 512
URL: http://svn.gnome.org/viewvc/libgweather?rev=512&view=rev

Log:
	* configure.in: check for libsoup-gnome-2.4 >= 2.25.1 and set
	HAVE_LIBSOUP_GNOME if found. Otherwise fall back to libsoup-2.4.
	(The fallback is a temporary convenience thing so we don't require
	libsoup trunk so early in the release cycle.)

	* libgweather/weather.c: remove the http proxy lookup code, and
	instead just use SoupProxyResolverGNOME when HAVE_LIBSOUP_GNOME.
	Fixes #393168 (gweather retrieval fails with automatic proxy
	config) and #344964 (Weather Report does not reload changed proxy
	configuration).


Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/libgweather/weather-priv.h
   trunk/libgweather/weather.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Tue Nov 25 16:33:16 2008
@@ -18,6 +18,7 @@
 GTK_REQUIRED=2.11.0
 GLIB_REQUIRED=2.13.0
 LIBSOUP_REQUIRED=2.4.0
+LIBSOUP_GNOME_REQUIRED=2.25.1
 GCONF_REQUIRED=2.8.0
 LIBXML_REQUIRED=2.6.0
 
@@ -91,8 +92,12 @@
 AC_SUBST(LIBXML_LIBS)
 
 dnl -- check for libsoup (required) -----------------------------------------
-PKG_CHECK_MODULES(LIBSOUP, 
-		  [libsoup-2.4 >= $LIBSOUP_REQUIRED])
+PKG_CHECK_MODULES(LIBSOUP_GNOME,
+		  [libsoup-gnome-2.4 >= $LIBSOUP_GNOME_REQUIRED],
+		  [LIBSOUP_CFLAGS="$LIBSOUP_GNOME_CFLAGS"
+		   LIBSOUP_LIBS="$LIBSOUP_GNOME_LIBS"
+		   AC_DEFINE(HAVE_LIBSOUP_GNOME, 1, [Have libsoup-gnome])],
+		  [PKG_CHECK_MODULES(LIBSOUP, [libsoup-2.4 >= $LIBSOUP_REQUIRED])])
 AC_SUBST(LIBSOUP_CFLAGS)
 AC_SUBST(LIBSOUP_LIBS)
 

Modified: trunk/libgweather/weather-priv.h
==============================================================================
--- trunk/libgweather/weather-priv.h	(original)
+++ trunk/libgweather/weather-priv.h	Tue Nov 25 16:33:16 2008
@@ -19,10 +19,16 @@
 #ifndef __WEATHER_PRIV_H_
 #define __WEATHER_PRIV_H_
 
+#include "config.h"
+
 #include <time.h>
 #include <libintl.h>
 #include <math.h>
+#ifdef HAVE_LIBSOUP_GNOME
+#include <libsoup/soup-gnome.h>
+#else
 #include <libsoup/soup.h>
+#endif
 
 #include "weather.h"
 #include "gweather-location.h"

Modified: trunk/libgweather/weather.c
==============================================================================
--- trunk/libgweather/weather.c	(original)
+++ trunk/libgweather/weather.c	Tue Nov 25 16:33:16 2008
@@ -37,7 +37,6 @@
 #include <gtk/gtkicontheme.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <gdk-pixbuf/gdk-pixbuf-loader.h>
-#include <gconf/gconf-client.h>
 
 #define GWEATHER_I_KNOW_THIS_IS_UNSTABLE
 #include "weather.h"
@@ -449,44 +448,6 @@
     return apparent;
 }
 
-static SoupSession *
-weather_session_new (void)
-{
-    SoupURI *proxy = NULL;
-    GConfClient *gconf;
-
-    gconf = gconf_client_get_default ();
-    if (gconf_client_get_bool (gconf, "/system/http_proxy/use_http_proxy", NULL)) {
-	char *host, *user, *password;
-	int port;
-
-	host = gconf_client_get_string (gconf, "/system/http_proxy/host", NULL);
-	port = gconf_client_get_int (gconf, "/system/http_proxy/port", NULL);
-	if (gconf_client_get_bool (gconf, "/system/http_proxy/use_authentication", NULL)) {
-	    user = gconf_client_get_string (gconf, "/system/http_proxy/authentication_user", NULL);
-	    password = gconf_client_get_string (gconf, "/system/http_proxy/authentication_password", NULL);
-	} else
-	    user = password = NULL;
-
-	if (host && *host) {
-	    proxy = soup_uri_new (NULL);
-	    soup_uri_set_scheme (proxy, SOUP_URI_SCHEME_HTTP);
-	    soup_uri_set_host (proxy, host);
-	    soup_uri_set_port (proxy, port);
-	    soup_uri_set_user (proxy, user);
-	    soup_uri_set_password (proxy, password);
-	}
-	g_free (host);
-	g_free (user);
-	g_free (password);
-
-	g_object_unref (gconf);
-    }
-
-    return soup_session_async_new_with_options (SOUP_SESSION_PROXY_URI, proxy,
-						NULL);
-}
-
 WeatherInfo *
 _weather_info_fill (WeatherInfo *info,
 		    WeatherLocation *location,
@@ -557,8 +518,12 @@
     info->finish_cb = cb;
     info->cb_data = data;
 
-    if (!info->session)
-	info->session = weather_session_new ();
+    if (!info->session) {
+	info->session = soup_session_async_new ();
+#ifdef HAVE_LIBSOUP_GNOME
+	soup_session_add_feature_by_type (info->session, SOUP_TYPE_PROXY_RESOLVER_GNOME);
+#endif
+    }
 
     metar_start_open (info);
     iwin_start_open (info);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]