Home | History | Annotate | Download | only in patches
      1 Index: evolution-data-server-2.22.1/servers/google/libgdata-google/gdata-google-service.c
      2 ===================================================================
      3 --- evolution-data-server-2.22.1/servers/google/libgdata-google/gdata-google-service.c	(revision 8671)
      4 +++ evolution-data-server-2.22.1/servers/google/libgdata-google/gdata-google-service.c	(working copy)
      5 @@ -23,6 +23,7 @@
      6   */
      7  
      8  #include <config.h>
      9 +#include <gconf/gconf-client.h>
     10  #include <gdata-service-iface.h>
     11  #include <gdata-google-service.h>
     12  
     13 @@ -462,6 +463,7 @@
     14  {
     15  	GDataGoogleServicePrivate *priv;
     16  	GDataGoogleService *self = (GDataGoogleService *)instance;
     17 +	GConfClient *conf_client;
     18  
     19  	/* Private data set by g_type_class_add_private */
     20  	priv = GDATA_GOOGLE_SERVICE_GET_PRIVATE(self);
     21 @@ -477,6 +479,45 @@
     22  	priv->auth->token = NULL;
     23  
     24  	priv->soup_session = soup_session_sync_new();
     25 +
     26 +	/* set the HTTP proxy, if configuration is set to do so */
     27 +	conf_client = gconf_client_get_default ();
     28 +	if (gconf_client_get_bool (conf_client, "/system/http_proxy/use_http_proxy", NULL)) {
     29 +		char *server, *proxy_uri;
     30 +		int port;
     31 +
     32 +		server = gconf_client_get_string (conf_client, "/system/http_proxy/host", NULL);
     33 +		port = gconf_client_get_int (conf_client, "/system/http_proxy/port", NULL);
     34 +
     35 +		if (server && server[0]) {
     36 +			SoupURI *suri;
     37 +			if (gconf_client_get_bool (conf_client, "/system/http_proxy/use_authentication", NULL)) {
     38 +				char *user, *password;
     39 +
     40 +				user = gconf_client_get_string (conf_client,
     41 +						"/system/http_proxy/authentication_user",
     42 +						NULL);
     43 +				password = gconf_client_get_string (conf_client,
     44 +						"/system/http_proxy/authentication_password",
     45 +						NULL);
     46 +
     47 +				proxy_uri = g_strdup_printf("http://%s:%s@%s:%d", user, password, server, port);
     48 +
     49 +				g_free (user);
     50 +				g_free (password);
     51 +			} else
     52 +				proxy_uri = g_strdup_printf ("http://%s:%d", server, port);
     53 +
     54 +			suri = soup_uri_new (proxy_uri);
     55 +			g_object_set (G_OBJECT (priv->soup_session), SOUP_SESSION_PROXY_URI, suri, NULL);
     56 +
     57 +			soup_uri_free (suri);
     58 +			g_free (server);
     59 +			g_free (proxy_uri);
     60 +		}
     61 +	}
     62 +
     63 +	g_object_unref (conf_client);
     64  }
     65  
     66  static void gdata_google_service_dispose(GObject *obj)
     67