From 5fb2281fc8e6beab84f5e2b1117455a65d2ab3de Mon Sep 17 00:00:00 2001
From: Tobias Markmann <tm@ayena.de>
Date: Wed, 1 Feb 2017 15:44:44 +0100
Subject: Update GConfProxyProvider to new string to HostAddress function

This change was missing in commit 43479ef.

glib is automatically initialised nowadays and g_type_init()
is a deprecated function. Surrounded the relevant code with
a GLIB_CHECK_VERSION macro.

Test-Information:

Tested build on Ubuntu 16.04.1 LTS.

Change-Id: Iea7242f6366d827b2cc6ce355cb923872f774a6c

diff --git a/Swiften/Network/GConfProxyProvider.cpp b/Swiften/Network/GConfProxyProvider.cpp
index 35303d5..40cd97c 100644
--- a/Swiften/Network/GConfProxyProvider.cpp
+++ b/Swiften/Network/GConfProxyProvider.cpp
@@ -5,31 +5,35 @@
  */
 
 /*
- * Copyright (c) 2016 Isode Limited.
+ * Copyright (c) 2016-2017 Isode Limited.
  * All rights reserved.
  * See the COPYING file for more information.
  */
 
 #include <Swiften/Network/GConfProxyProvider.h>
 
-#include <stdio.h>
-#include <stdlib.h>
+#include <cstdio>
+#include <cstdlib>
 
 #include <iostream>
 
+export "C" {
 #include <gconf/gconf-client.h>
+}
 
 #include <Swiften/Base/Log.h>
 
 namespace Swift {
 
 GConfProxyProvider::GConfProxyProvider() {
+#if !GLIB_CHECK_VERSION(2,35,0)
     // Ensure static GLib initialization methods are called
     static bool glibInitialized = false;
     if (!glibInitialized) {
         g_type_init();
         glibInitialized = true;
     }
+#endif
 
     socksProxy = getFromGConf("/system/proxy/socks_host", "/system/proxy/socks_port");
     httpProxy = getFromGConf("/system/http_proxy/host", "/system/http_proxy/port");
@@ -60,7 +64,7 @@ HostAddressPort GConfProxyProvider::getFromGConf(const char* gcHost, const char*
     }
 
     g_object_unref(client);
-    return HostAddressPort(HostAddress(address), port);
+    return HostAddressPort(HostAddress::fromString(address).get_value_or(HostAddress()), port);
 }
 
 }
-- 
cgit v0.10.2-6-g49f6