From a03cedb3942e4c7c90e62fe9a73c6d15e38fbb68 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Mon, 13 Jun 2011 18:06:28 +0200
Subject: Privatize GConfProxyProvider in UnixProxyProvider.


diff --git a/Swiften/Network/UnixProxyProvider.cpp b/Swiften/Network/UnixProxyProvider.cpp
index 04c95e4..7790ad8 100644
--- a/Swiften/Network/UnixProxyProvider.cpp
+++ b/Swiften/Network/UnixProxyProvider.cpp
@@ -10,25 +10,33 @@
 
 #include <Swiften/Base/foreach.h>
 #include <Swiften/Network/UnixProxyProvider.h>
+#if defined(HAVE_GCONF)
+#  include "Swiften/Network/GConfProxyProvider.h"
+#endif
 
 namespace Swift {
 
 UnixProxyProvider::UnixProxyProvider() :
-#if defined(HAVE_GCONF)
-	gconfProxyProvider(),
-#endif
+	gconfProxyProvider(0),
 	environmentProxyProvider()
 {
+#if defined(HAVE_GCONF)
+	gconfProxyProvider = new GConfProxyProvider();
+#endif
+}
+
+UnixProxyProvider::~UnixProxyProvider() {
+	delete gconfProxyProvider;
 }
 
 HostAddressPort UnixProxyProvider::getSOCKS5Proxy() const {
 	HostAddressPort proxy;
-#if defined(HAVE_GCONF)
-	proxy = gconfProxyProvider.getSOCKS5Proxy();
-	if(proxy.isValid()) {
-		return proxy;
+	if (gconfProxyProvider) {
+		proxy = gconfProxyProvider.getSOCKS5Proxy();
+		if(proxy.isValid()) {
+			return proxy;
+		}
 	}
-#endif
 	proxy = environmentProxyProvider.getSOCKS5Proxy();
 	if(proxy.isValid()) {
 		return proxy;
@@ -38,12 +46,12 @@ HostAddressPort UnixProxyProvider::getSOCKS5Proxy() const {
 
 HostAddressPort UnixProxyProvider::getHTTPConnectProxy() const {
 	HostAddressPort proxy;
-#if defined(HAVE_GCONF)
-	proxy = gconfProxyProvider.getHTTPConnectProxy();
-	if(proxy.isValid()) {
-		return proxy;
+	if (gconfProxyProvider) {
+		proxy = gconfProxyProvider.getHTTPConnectProxy();
+		if(proxy.isValid()) {
+			return proxy;
+		}
 	}
-#endif
 	proxy = environmentProxyProvider.getHTTPConnectProxy();
 	if(proxy.isValid()) {
 		return proxy;
diff --git a/Swiften/Network/UnixProxyProvider.h b/Swiften/Network/UnixProxyProvider.h
index 8657a95..37a4d05 100644
--- a/Swiften/Network/UnixProxyProvider.h
+++ b/Swiften/Network/UnixProxyProvider.h
@@ -5,21 +5,22 @@
  */
 
 #pragma once
-#if defined(HAVE_GCONF)
-#  include "Swiften/Network/GConfProxyProvider.h"
-#endif
+
 #include <Swiften/Network/EnvironmentProxyProvider.h>
 
 namespace Swift {
+	class GConfProxyProvider;
+
 	class UnixProxyProvider : public ProxyProvider {
 		public:
 			UnixProxyProvider();
+			~UnixProxyProvider();
+
 			virtual HostAddressPort getHTTPConnectProxy() const;
 			virtual HostAddressPort getSOCKS5Proxy() const;
+
 		private:
-#if defined(HAVE_GCONF)
-			GConfProxyProvider gconfProxyProvider;
-#endif
+			GConfProxyProvider* gconfProxyProvider;
 			EnvironmentProxyProvider environmentProxyProvider;
 	};
 }
-- 
cgit v0.10.2-6-g49f6