]> err.no Git - libchamplain/commitdiff
Finish the fix to bug 573037: Support proxies
authorPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Fri, 24 Apr 2009 03:19:39 +0000 (23:19 -0400)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Fri, 24 Apr 2009 03:19:39 +0000 (23:19 -0400)
By linking against libsoup-gnome (and enabling its features),
libchamplain will gain autodetection of proxies.

champlain/Makefile.am
champlain/champlain-network-map-source.c
configure.ac

index 9a6f139f651f94d56c326ff946c1c12d154cbd89..40bdb32720cd511af245b41b3cba43704ed046c9 100644 (file)
@@ -72,7 +72,7 @@ libchamplain_include_HEADERS = \
        champlain-marker.h              \
        champlain-version.h
 
-libchamplain_0_3_la_LIBADD = $(DEPS_LIBS) ../tidy/libtidy-1.0.la
+libchamplain_0_3_la_LIBADD = $(DEPS_LIBS) $(SOUP_LIBS) ../tidy/libtidy-1.0.la
 
 libchamplain_includedir = $(includedir)/libchamplain-0.3/champlain
 
@@ -82,6 +82,7 @@ libchamplain_0_3_la_LDFLAGS = -version-info $(LIBRARY_VERSION) \
 
 AM_CPPFLAGS =                          \
        $(DEPS_CFLAGS)                  \
+       $(SOUP_CFLAGS)                  \
        -DDATADIR=\""$(datadir)"\"      \
        -I$(top_srcdir)/tidy            \
        -I$(top_srcdir)                 \
index 44772880de2c9b4451bd5690dd17175de21f49c1..8b998cafa6d887c3af30da0c4f1dcd63bbbf034f 100644 (file)
 #include <glib.h>
 #include <glib/gprintf.h>
 #include <glib-object.h>
+#ifdef HAVE_LIBSOUP_GNOME
+#include <libsoup/soup-gnome.h>
+#else
 #include <libsoup/soup.h>
+#endif
 #include <math.h>
 #include <string.h>
 #include <clutter-cairo.h>
@@ -574,7 +578,11 @@ champlain_network_map_source_get_tile (ChamplainMapSource *map_source,
 
       if (!soup_session)
         soup_session = soup_session_async_new_with_options ("proxy-uri",
-            soup_uri_new (priv->proxy_uri), NULL);
+            soup_uri_new (priv->proxy_uri),
+#ifdef HAVE_LIBSOUP_GNOME
+            SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_PROXY_RESOLVER_GNOME,
+#endif
+            NULL);
 
       uri = champlain_network_map_source_get_tile_uri (network_map_source,
                champlain_tile_get_x (tile), champlain_tile_get_y (tile),
index 2866678fbb179612d8dc7e6a1a5ef91d9ca52025..243595a931272c697420e38c9291a6d12e1901d3 100644 (file)
@@ -52,7 +52,6 @@ PKG_CHECK_MODULES(DEPS,
       clutter-0.8 >= 0.8.4,
       clutter-cairo-0.8 >= 0.8,
       cairo >= 1.4,
-      libsoup-2.4 >= 2.4.1,
       gio-2.0 >= 2.16
   ]
 )
@@ -60,6 +59,22 @@ PKG_CHECK_MODULES(DEPS,
 GTK_DOC_CHECK(1.9)
 IDT_COMPILE_WARNINGS
 
+# -----------------------------------------------------------
+# Check for libsoup, use libsoup-gnome if available
+# -----------------------------------------------------------
+PKG_CHECK_MODULES(SOUP, libsoup-gnome-2.4 >= 2.27, [
+    have_soup_gnome="yes",
+    AC_DEFINE(HAVE_LIBSOUP_GNOME,1,[libsoup gnome integration])
+    ], have_soup_gnome="no")
+
+if test "x$have_soup_gnome" = "xno"; then
+  PKG_CHECK_MODULES(SOUP, libsoup-2.4 >= 2.4.1,
+     have_soup="yes", have_soup="no")
+fi
+
+AC_SUBST(SOUP_CFLAGS)
+AC_SUBST(SOUP_LIBS)
+
 # -----------------------------------------------------------
 # Enable debug
 # -----------------------------------------------------------
@@ -210,6 +225,7 @@ echo "          Prefix: ${prefix}"
 echo "  Compiler flags: ${CPPFLAGS}"
 echo "   Documentation: ${enable_gtk_doc}"
 echo "           Debug: ${enable_debug}"
+echo "   libsoup-gnome: ${have_soup_gnome}"
 echo "       Gtk+ View: ${enable_gtk}"
 echo ""
 echo "Bindings:"