[grilo] net: SoupRequester is deprecated for libsoup >= 2.41.3
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo] net: SoupRequester is deprecated for libsoup >= 2.41.3
- Date: Tue, 15 Jan 2013 11:43:10 +0000 (UTC)
commit 5d4cdd7edc2233c8753189b16f87bec3569ec3ec
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Tue Jan 15 11:42:19 2013 +0000
net: SoupRequester is deprecated for libsoup >= 2.41.3
Use SoupSession instead.
configure.ac | 6 ++++++
libs/net/Makefile.am | 5 +++++
libs/net/grl-net-private.h | 2 ++
libs/net/grl-net-soup-unstable.c | 17 ++++++++++++++++-
4 files changed, 29 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 7fd4ad8..dec1075 100644
--- a/configure.ac
+++ b/configure.ac
@@ -162,6 +162,11 @@ PKG_CHECK_MODULES(NET, libsoup-2.4,
PKG_CHECK_EXISTS([libsoup-2.4 >= 2.33.4],
[HAVE_CACHED_LIBSOUP=yes],
[HAVE_CACHED_LIBSOUP=no])
+
+PKG_CHECK_EXISTS([libsoup-2.4 >= 2.41.3],
+ [HAVE_LIBSOUP_REQUESTER_DEPRECATED=yes],
+ [HAVE_LIBSOUP_REQUESTER_DEPRECATED=no])
+
AC_ARG_ENABLE([grl_net],
AS_HELP_STRING([--enable-grl-net],
[Enable Grilo Net library (default: auto)]),
@@ -180,6 +185,7 @@ AC_ARG_ENABLE([grl_net],
AM_CONDITIONAL(BUILD_GRILO_NET, test "x$HAVE_LIBSOUP" = "xyes")
AM_CONDITIONAL(BUILD_GRILO_NET_WITH_CACHE, test "x$HAVE_CACHED_LIBSOUP" = "xyes")
+AM_CONDITIONAL(BUILD_GRILO_NET_WITH_DEPRECATED_REQUESTER, test "x$HAVE_LIBSOUP_REQUESTER_DEPRECATED" = "xyes")
# ----------------------------------------------------------
# DEBUG SUPPORT
diff --git a/libs/net/Makefile.am b/libs/net/Makefile.am
index a286e17..703cc6e 100644
--- a/libs/net/Makefile.am
+++ b/libs/net/Makefile.am
@@ -32,6 +32,11 @@ libgrlnet_ GRL_MAJORMINOR@_la_SOURCES += \
grl-net-soup-stable.c
endif
+if BUILD_GRILO_NET_WITH_DEPRECATED_REQUESTER
+libgrlnet_ GRL_MAJORMINOR@_la_CFLAGS += \
+ -DLIBSOUP_REQUESTER_DEPRECATED
+endif
+
libgrlnet_ GRL_MAJORMINOR@_la_LIBADD = \
$(top_builddir)/src/lib GRL_NAME@.la \
$(DEPS_LIBS) \
diff --git a/libs/net/grl-net-private.h b/libs/net/grl-net-private.h
index bd5f411..cc2e9b6 100644
--- a/libs/net/grl-net-private.h
+++ b/libs/net/grl-net-private.h
@@ -46,7 +46,9 @@ struct _GrlNetWcPrivate {
GTimeVal last_request; /* last request time */
GQueue *pending; /* closure queue for delayed requests */
guint cache_size; /* cache size in Mb */
+#ifndef LIBSOUP_REQUESTER_DEPRECATED
void *requester;
+#endif
gchar *previous_data;
};
diff --git a/libs/net/grl-net-soup-unstable.c b/libs/net/grl-net-soup-unstable.c
index 2178f98..ce86baa 100644
--- a/libs/net/grl-net-soup-unstable.c
+++ b/libs/net/grl-net-soup-unstable.c
@@ -33,9 +33,12 @@
#define LIBSOUP_USE_UNSTABLE_REQUEST_API
#include <libsoup/soup-cache.h>
-#include <libsoup/soup-requester.h>
#include <libsoup/soup-request-http.h>
+#ifndef LIBSOUP_REQUESTER_DEPRECATED
+#include <libsoup/soup-requester.h>
+#endif
+
#include "grl-net-private.h"
#define GRL_LOG_DOMAIN_DEFAULT wc_log_domain
@@ -47,11 +50,13 @@ guint cache_size;
void
init_requester (GrlNetWc *self)
{
+#ifndef LIBSOUP_REQUESTER_DEPRECATED
GrlNetWcPrivate *priv = self->priv;
priv->requester = soup_requester_new ();
soup_session_add_feature (priv->session,
SOUP_SESSION_FEATURE (priv->requester));
+#endif
init_dump_directory ();
}
@@ -62,7 +67,10 @@ finalize_requester (GrlNetWc *self)
cache_down (self);
g_free (priv->previous_data);
+
+#ifndef LIBSOUP_REQUESTER_DEPRECATED
g_object_unref (priv->requester);
+#endif
}
void
@@ -259,7 +267,14 @@ get_url_now (GrlNetWc *self,
rr,
NULL);
+#ifdef LIBSOUP_REQUESTER_DEPRECATED
+ SoupURI *uri = soup_uri_new (url);
+ rr->request = soup_session_request_uri (priv->session, uri, NULL);
+ soup_uri_free (uri);
+#else
rr->request = soup_requester_request (priv->requester, url, NULL);
+#endif
+
if (headers != NULL) {
SoupMessage *message;
GHashTableIter iter;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]