[seahorse] soup: use the SoupProxyResolverDefault feature



commit 8a2b65c3a3a1a3f4ab4f9f5cd2daababa43f58f3
Author: Andres Gomez <agomez igalia com>
Date:   Fri Jun 7 01:43:19 2013 +0300

    soup: use the SoupProxyResolverDefault feature
    
    soup is capable of automatically resolving the
    HTTP proxy to use from system settings through
    the usage of the SoupProxyResolverDefault.
    
    Let's leave the hard work to soup and forget
    about doing it manually in seahorse.
    
    Bumps libsoup dependency up to 2.33.92.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682495

 configure.ac              |    2 +-
 pgp/seahorse-hkp-source.c |   75 ++-------------------------------------------
 2 files changed, 4 insertions(+), 73 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 264eed7..0cadb50 100644
--- a/configure.ac
+++ b/configure.ac
@@ -305,7 +305,7 @@ else
     
     echo "checking for supported versions of libsoup..."
 
-    PKG_CHECK_MODULES(SOUP, libsoup-2.4 >= 2.24.0, 
+    PKG_CHECK_MODULES(SOUP, libsoup-2.4 >= 2.33.92,
         [enable_hkp=yes],  
         [enable_hkp=no])
 
diff --git a/pgp/seahorse-hkp-source.c b/pgp/seahorse-hkp-source.c
index a945b4e..c25a0ca 100644
--- a/pgp/seahorse-hkp-source.c
+++ b/pgp/seahorse-hkp-source.c
@@ -116,74 +116,6 @@ get_http_server_uri (SeahorseHKPSource *self, const char *path)
     return uri;
 }
 
-static gboolean
-check_for_http_proxy_schema__with_love_to_ryan ()
-{
-       const gchar * const* schemas;
-       guint i;
-
-       /*
-        * This isn't very efficient, but it's the only way to use this schema
-        * without our GSettings killing our process if the schema doesn't exist.
-        *
-        * Groan.
-        */
-
-       schemas = g_settings_list_schemas ();
-       for (i = 0; schemas[i] != NULL; i++) {
-               if (g_str_equal (schemas[i], "org.gnome.system.proxy.http"))
-                       return TRUE;
-       }
-
-       return FALSE;
-}
-
-static SoupSession *
-create_proxy_session (void)
-{
-       SoupSession *session = NULL;
-       SoupURI *uri;
-       GSettings *settings;
-       gchar *host;
-       gchar *user;
-       gchar *password;
-
-       if (!check_for_http_proxy_schema__with_love_to_ryan ())
-               return NULL;
-
-       settings = g_settings_new ("org.gnome.system.proxy.http");
-       if (g_settings_get_boolean (settings, "enabled")) {
-               host = g_settings_get_string (settings, "host");
-               if (host) {
-                       uri = soup_uri_new (NULL);
-                       if (!uri) {
-                               g_warning ("creation of SoupURI from '%s' failed", host);
-                       } else {
-                               soup_uri_set_scheme (uri, SOUP_URI_SCHEME_HTTP);
-                               soup_uri_set_host (uri, host);
-                       }
-                       g_free (host);
-                       soup_uri_set_port (uri, g_settings_get_int (settings, "port"));
-
-                       if (g_settings_get_boolean (settings, "use-authentication")) {
-                               user = g_settings_get_string (settings, "authentication-user");
-                               soup_uri_set_user (uri, user);
-                               g_free (user);
-
-                               password = g_settings_get_string (settings, "authentication-password");
-                               soup_uri_set_password (uri, password);
-                               g_free (password);
-                       }
-
-                       session = soup_session_async_new_with_options (SOUP_SESSION_PROXY_URI, uri, NULL);
-                       soup_uri_free (uri);
-               }
-       }
-
-       g_object_unref (settings);
-       return session;
-}
-
 static SoupSession *
 create_hkp_soup_session (void)
 {
@@ -192,11 +124,10 @@ create_hkp_soup_session (void)
        SoupLogger *logger;
 #endif
 
-       session = create_proxy_session ();
+        session = soup_session_async_new_with_options (SOUP_SESSION_ADD_FEATURE_BY_TYPE,
+                                                       SOUP_TYPE_PROXY_RESOLVER_DEFAULT,
+                                                       NULL);
 
-       /* Without a proxy */
-       if (session == NULL)
-               session = soup_session_async_new ();
 
 #if WITH_DEBUG
        if (seahorse_debugging) {


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