[evolution] Use SoupSession's request API instead of SoupRequester.



commit 3982c52a51620fdd54cf006462b0b09d22a16559
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue Nov 26 11:06:38 2013 -0500

    Use SoupSession's request API instead of SoupRequester.
    
    SoupRequester functionality is built directly into SoupSession now.

 e-util/e-web-view.c                        |   25 ++-----------------------
 modules/gravatar/e-gravatar-photo-source.c |    9 +--------
 2 files changed, 3 insertions(+), 31 deletions(-)
---
diff --git a/e-util/e-web-view.c b/e-util/e-web-view.c
index b013f3d..b83af3f 100644
--- a/e-util/e-web-view.c
+++ b/e-util/e-web-view.c
@@ -30,9 +30,7 @@
 #include <camel/camel.h>
 #include <libebackend/libebackend.h>
 
-#define LIBSOUP_USE_UNSTABLE_REQUEST_API
 #include <libsoup/soup.h>
-#include <libsoup/soup-requester.h>
 
 #include "e-alert-dialog.h"
 #include "e-alert-sink.h"
@@ -3181,8 +3179,6 @@ e_web_view_request (EWebView *web_view,
                     gpointer user_data)
 {
        SoupSession *session;
-       SoupSessionFeature *feature;
-       SoupRequester *requester;
        SoupRequest *request;
        gchar *real_uri;
        GSimpleAsyncResult *simple;
@@ -3194,10 +3190,6 @@ e_web_view_request (EWebView *web_view,
 
        session = webkit_get_default_session ();
 
-       /* SoupRequester feature should have already been added. */
-       feature = soup_session_get_feature (session, SOUP_TYPE_REQUESTER);
-       g_return_if_fail (feature != NULL);
-
        async_context = g_slice_new0 (AsyncContext);
 
        simple = g_simple_async_result_new (
@@ -3209,9 +3201,8 @@ e_web_view_request (EWebView *web_view,
        g_simple_async_result_set_op_res_gpointer (
                simple, async_context, (GDestroyNotify) async_context_free);
 
-       requester = SOUP_REQUESTER (feature);
        real_uri = e_web_view_redirect_uri (web_view, uri);
-       request = soup_requester_request (requester, real_uri, &local_error);
+       request = soup_session_request (session, real_uri, &local_error);
        g_free (real_uri);
 
        /* Sanity check. */
@@ -3277,21 +3268,9 @@ e_web_view_install_request_handler (EWebView *web_view,
                                     GType handler_type)
 {
        SoupSession *session;
-       SoupSessionFeature *feature;
 
        session = webkit_get_default_session ();
-
-       feature = soup_session_get_feature (session, SOUP_TYPE_REQUESTER);
-       if (feature != NULL) {
-               g_object_ref (feature);
-       } else {
-               feature = SOUP_SESSION_FEATURE (soup_requester_new ());
-               soup_session_add_feature (session, feature);
-       }
-
-       soup_session_feature_add_feature (feature, handler_type);
-
-       g_object_unref (feature);
+       soup_session_add_feature_by_type (session, handler_type);
 }
 
 static void
diff --git a/modules/gravatar/e-gravatar-photo-source.c b/modules/gravatar/e-gravatar-photo-source.c
index 18a49e0..362666e 100644
--- a/modules/gravatar/e-gravatar-photo-source.c
+++ b/modules/gravatar/e-gravatar-photo-source.c
@@ -19,8 +19,6 @@
 #include "e-gravatar-photo-source.h"
 
 #include <libsoup/soup.h>
-#include <libsoup/soup-requester.h>
-#include <libsoup/soup-request-http.h>
 #include <libedataserver/libedataserver.h>
 
 #define E_GRAVATAR_PHOTO_SOURCE_GET_PRIVATE(obj) \
@@ -64,7 +62,6 @@ gravatar_photo_source_get_photo_thread (GSimpleAsyncResult *simple,
                                         GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       SoupRequester *requester;
        SoupRequest *request;
        SoupSession *session;
        GInputStream *stream = NULL;
@@ -96,11 +93,8 @@ gravatar_photo_source_get_photo_thread (GSimpleAsyncResult *simple,
 
        g_clear_object (&proxy);
 
-       requester = soup_requester_new ();
-       soup_session_add_feature (session, SOUP_SESSION_FEATURE (requester));
-
        /* We control the URI so there should be no error. */
-       request = soup_requester_request (requester, uri, NULL);
+       request = soup_session_request (session, uri, NULL);
        g_return_if_fail (request != NULL);
 
        stream = soup_request_send (request, cancellable, &local_error);
@@ -143,7 +137,6 @@ gravatar_photo_source_get_photo_thread (GSimpleAsyncResult *simple,
 
        g_debug ("Request complete");
 
-       g_clear_object (&requester);
        g_clear_object (&request);
        g_clear_object (&session);
 


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