# HG changeset patch
# Node ID 9332862352c8
# Parent  c110f79423b3
diff --git a/ChangeLog.API b/ChangeLog.API
--- a/ChangeLog.API
+++ b/ChangeLog.API
@@ -223,7 +223,10 @@
 		  purple_plugin_pref_set_pref_type
 		* purple_prefs_get_type renamed to purple_prefs_get_pref_type
 		* proto_chat_entry has been renamed to PurpleProtocolChatEntry
+		* PurpleProxyType members are now name spaced under PURPLE_PROXY_TYPE_*
+		* purple_proxy_info_get_host renamed to purple_proxy_info_get_hostname
 		* purple_proxy_info_get_type renamed to purple_proxy_info_get_proxy_type
+		* purple_proxy_info_set_host renamed to purple_proxy_info_set_hostname
 		* purple_proxy_info_set_type renamed to purple_proxy_info_set_proxy_type
 		* purple_request_field_get_type renamed to
 		  purple_request_field_get_field_type
diff --git a/libpurple/account.h b/libpurple/account.h
--- a/libpurple/account.h
+++ b/libpurple/account.h
@@ -46,8 +46,8 @@
 #include "buddy.h"
 #include "connection.h"
 #include "group.h"
-#include "proxy.h"
 #include "purpleprotocol.h"
+#include "purpleproxyinfo.h"
 #include "status.h"
 #include "xmlnode.h"
 
diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -562,7 +562,7 @@
  * XmlNode Helpers
  *****************************************************************************/
 static PurpleXmlNode *
-proxy_settings_to_xmlnode(const PurpleProxyInfo *proxy_info)
+proxy_settings_to_xmlnode(PurpleProxyInfo *proxy_info)
 {
 	PurpleXmlNode *node, *child;
 	PurpleProxyType proxy_type;
@@ -576,15 +576,15 @@
 
 	child = purple_xmlnode_new_child(node, "type");
 	purple_xmlnode_insert_data(child,
-			(proxy_type == PURPLE_PROXY_USE_GLOBAL ? "global" :
-			 proxy_type == PURPLE_PROXY_NONE       ? "none"   :
-			 proxy_type == PURPLE_PROXY_HTTP       ? "http"   :
-			 proxy_type == PURPLE_PROXY_SOCKS4     ? "socks4" :
-			 proxy_type == PURPLE_PROXY_SOCKS5     ? "socks5" :
-			 proxy_type == PURPLE_PROXY_TOR        ? "tor" :
-			 proxy_type == PURPLE_PROXY_USE_ENVVAR ? "envvar" : "unknown"), -1);
-
-	if ((value = purple_proxy_info_get_host(proxy_info)) != NULL)
+			(proxy_type == PURPLE_PROXY_TYPE_USE_GLOBAL ? "global" :
+			 proxy_type == PURPLE_PROXY_TYPE_NONE       ? "none"   :
+			 proxy_type == PURPLE_PROXY_TYPE_HTTP       ? "http"   :
+			 proxy_type == PURPLE_PROXY_TYPE_SOCKS4     ? "socks4" :
+			 proxy_type == PURPLE_PROXY_TYPE_SOCKS5     ? "socks5" :
+			 proxy_type == PURPLE_PROXY_TYPE_TOR        ? "tor" :
+			 proxy_type == PURPLE_PROXY_TYPE_USE_ENVVAR ? "envvar" : "unknown"), -1);
+
+	if ((value = purple_proxy_info_get_hostname(proxy_info)) != NULL)
 	{
 		child = purple_xmlnode_new_child(node, "host");
 		purple_xmlnode_insert_data(child, value, -1);
@@ -701,7 +701,7 @@
 {
 	PurpleXmlNode *node, *child;
 	const char *tmp;
-	const PurpleProxyInfo *proxy_info;
+	PurpleProxyInfo *proxy_info;
 	PurpleAccountPrivate *priv = purple_account_get_instance_private(account);
 
 	node = purple_xmlnode_new("account");
@@ -968,8 +968,7 @@
 
 	purple_account_set_status_types(account, NULL);
 
-	if (priv->proxy_info)
-		purple_proxy_info_destroy(priv->proxy_info);
+	g_clear_object(&priv->proxy_info);
 
 	if (priv->current_error) {
 		g_free(priv->current_error->description);
@@ -1650,8 +1649,7 @@
 
 	priv = purple_account_get_instance_private(account);
 
-	if (priv->proxy_info != NULL)
-		purple_proxy_info_destroy(priv->proxy_info);
+	g_clear_object(&priv->proxy_info);
 
 	priv->proxy_info = info;
 
diff --git a/libpurple/accounts.c b/libpurple/accounts.c
--- a/libpurple/accounts.c
+++ b/libpurple/accounts.c
@@ -204,26 +204,26 @@
 	proxy_info = purple_proxy_info_new();
 
 	/* Use the global proxy settings, by default */
-	purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_USE_GLOBAL);
+	purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_TYPE_USE_GLOBAL);
 
 	/* Read proxy type */
 	child = purple_xmlnode_get_child(node, "type");
 	if ((child != NULL) && ((data = purple_xmlnode_get_data(child)) != NULL))
 	{
 		if (purple_strequal(data, "global"))
-			purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_USE_GLOBAL);
+			purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_TYPE_USE_GLOBAL);
 		else if (purple_strequal(data, "none"))
-			purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_NONE);
+			purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_TYPE_NONE);
 		else if (purple_strequal(data, "http"))
-			purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_HTTP);
+			purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_TYPE_HTTP);
 		else if (purple_strequal(data, "socks4"))
-			purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_SOCKS4);
+			purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_TYPE_SOCKS4);
 		else if (purple_strequal(data, "socks5"))
-			purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_SOCKS5);
+			purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_TYPE_SOCKS5);
 		else if (purple_strequal(data, "tor"))
-			purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_TOR);
+			purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_TYPE_TOR);
 		else if (purple_strequal(data, "envvar"))
-			purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_USE_ENVVAR);
+			purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_TYPE_USE_ENVVAR);
 		else
 		{
 			purple_debug_error("accounts", "Invalid proxy type found when "
@@ -237,7 +237,7 @@
 	child = purple_xmlnode_get_child(node, "host");
 	if ((child != NULL) && ((data = purple_xmlnode_get_data(child)) != NULL))
 	{
-		purple_proxy_info_set_host(proxy_info, data);
+		purple_proxy_info_set_hostname(proxy_info, data);
 		g_free(data);
 	}
 
@@ -266,13 +266,13 @@
 	}
 
 	/* If there are no values set then proxy_info NULL */
-	if ((purple_proxy_info_get_proxy_type(proxy_info) == PURPLE_PROXY_USE_GLOBAL) &&
-		(purple_proxy_info_get_host(proxy_info) == NULL) &&
+	if ((purple_proxy_info_get_proxy_type(proxy_info) == PURPLE_PROXY_TYPE_USE_GLOBAL) &&
+		(purple_proxy_info_get_hostname(proxy_info) == NULL) &&
 		(purple_proxy_info_get_port(proxy_info) == 0) &&
 		(purple_proxy_info_get_username(proxy_info) == NULL) &&
 		(purple_proxy_info_get_password(proxy_info) == NULL))
 	{
-		purple_proxy_info_destroy(proxy_info);
+		g_clear_object(&proxy_info);
 		return;
 	}
 
diff --git a/libpurple/meson.build b/libpurple/meson.build
--- a/libpurple/meson.build
+++ b/libpurple/meson.build
@@ -73,6 +73,7 @@
 	'purpleprotocolprivacy.c',
 	'purpleprotocolroomlist.c',
 	'purpleprotocolserver.c',
+	'purpleproxyinfo.c',
 	'purplesqlitehistoryadapter.c',
 	'purpleuiinfo.c',
 	'purplewhiteboard.c',
@@ -166,6 +167,7 @@
 	'purpleprotocolprivacy.h',
 	'purpleprotocolroomlist.h',
 	'purpleprotocolserver.h',
+	'purpleproxyinfo.h',
 	'purplesqlitehistoryadapter.h',
 	'purpleuiinfo.h',
 	'purplewhiteboard.h',
@@ -242,6 +244,7 @@
 	'purplemessage.h',
 	'purpleplugininfo.h',
 	'purpleprotocol.h',
+	'purpleproxyinfo.h',
 	'roomlist.h',
 	'status.h',
 	'xfer.h',
diff --git a/libpurple/protocols/jabber/si.c b/libpurple/protocols/jabber/si.c
--- a/libpurple/protocols/jabber/si.c
+++ b/libpurple/protocols/jabber/si.c
@@ -1013,7 +1013,7 @@
 	 *       piggy-backing on the TOR proxy type. */
 	proxy_type = purple_proxy_info_get_proxy_type(
 	        purple_proxy_get_setup(purple_connection_get_account(jsx->js->gc)));
-	if (proxy_type == PURPLE_PROXY_TOR) {
+	if (proxy_type == PURPLE_PROXY_TYPE_TOR) {
 		purple_debug_info("jabber", "Skipping attempting local streamhost.\n");
 		jsx->service = NULL;
 	} else {
diff --git a/libpurple/proxy.h b/libpurple/proxy.h
--- a/libpurple/proxy.h
+++ b/libpurple/proxy.h
@@ -30,166 +30,12 @@
 #include <gio/gio.h>
 #include "eventloop.h"
 
-/**
- * PurpleProxyType:
- * @PURPLE_PROXY_USE_GLOBAL: Use the global proxy information.
- * @PURPLE_PROXY_NONE:       No proxy.
- * @PURPLE_PROXY_HTTP:       HTTP proxy.
- * @PURPLE_PROXY_SOCKS4:     SOCKS 4 proxy.
- * @PURPLE_PROXY_SOCKS5:     SOCKS 5 proxy.
- * @PURPLE_PROXY_USE_ENVVAR: Use environmental settings.
- * @PURPLE_PROXY_TOR:        Use a Tor proxy (SOCKS 5 really).
- *
- * A type of proxy connection.
- */
-typedef enum
-{
-	PURPLE_PROXY_USE_GLOBAL = -1,
-	PURPLE_PROXY_NONE = 0,
-	PURPLE_PROXY_HTTP,
-	PURPLE_PROXY_SOCKS4,
-	PURPLE_PROXY_SOCKS5,
-	PURPLE_PROXY_USE_ENVVAR,
-	PURPLE_PROXY_TOR
-
-} PurpleProxyType;
-
-/**
- * PurpleProxyInfo:
- *
- * Information on proxy settings.
- */
-typedef struct _PurpleProxyInfo PurpleProxyInfo;
-
-
 #include "account.h"
+#include "purpleproxyinfo.h"
 
 G_BEGIN_DECLS
 
 /**************************************************************************/
-/* Proxy structure API                                                    */
-/**************************************************************************/
-
-/**
- * purple_proxy_info_get_type:
- *
- * Returns: The #GType for proxy information.
- */
-GType purple_proxy_info_get_type(void);
-
-/**
- * purple_proxy_info_new:
- *
- * Creates a proxy information structure.
- *
- * Returns: The proxy information structure.
- */
-PurpleProxyInfo *purple_proxy_info_new(void);
-
-/**
- * purple_proxy_info_destroy:
- * @info: The proxy information structure to destroy.
- *
- * Destroys a proxy information structure.
- */
-void purple_proxy_info_destroy(PurpleProxyInfo *info);
-
-/**
- * purple_proxy_info_set_proxy_type:
- * @info: The proxy information.
- * @type: The proxy type.
- *
- * Sets the type of proxy.
- */
-void purple_proxy_info_set_proxy_type(PurpleProxyInfo *info, PurpleProxyType type);
-
-/**
- * purple_proxy_info_set_host:
- * @info: The proxy information.
- * @host: The host.
- *
- * Sets the proxy host.
- */
-void purple_proxy_info_set_host(PurpleProxyInfo *info, const char *host);
-
-/**
- * purple_proxy_info_set_port:
- * @info: The proxy information.
- * @port: The port.
- *
- * Sets the proxy port.
- */
-void purple_proxy_info_set_port(PurpleProxyInfo *info, int port);
-
-/**
- * purple_proxy_info_set_username:
- * @info:     The proxy information.
- * @username: The username.
- *
- * Sets the proxy username.
- */
-void purple_proxy_info_set_username(PurpleProxyInfo *info, const char *username);
-
-/**
- * purple_proxy_info_set_password:
- * @info:     The proxy information.
- * @password: The password.
- *
- * Sets the proxy password.
- */
-void purple_proxy_info_set_password(PurpleProxyInfo *info, const char *password);
-
-/**
- * purple_proxy_info_get_proxy_type:
- * @info: The proxy information.
- *
- * Returns the proxy's type.
- *
- * Returns: The type.
- */
-PurpleProxyType purple_proxy_info_get_proxy_type(const PurpleProxyInfo *info);
-
-/**
- * purple_proxy_info_get_host:
- * @info: The proxy information.
- *
- * Returns the proxy's host.
- *
- * Returns: The host.
- */
-const char *purple_proxy_info_get_host(const PurpleProxyInfo *info);
-
-/**
- * purple_proxy_info_get_port:
- * @info: The proxy information.
- *
- * Returns the proxy's port.
- *
- * Returns: The port.
- */
-int purple_proxy_info_get_port(const PurpleProxyInfo *info);
-
-/**
- * purple_proxy_info_get_username:
- * @info: The proxy information.
- *
- * Returns the proxy's username.
- *
- * Returns: The username.
- */
-const char *purple_proxy_info_get_username(const PurpleProxyInfo *info);
-
-/**
- * purple_proxy_info_get_password:
- * @info: The proxy information.
- *
- * Returns the proxy's password.
- *
- * Returns: The password.
- */
-const char *purple_proxy_info_get_password(const PurpleProxyInfo *info);
-
-/**************************************************************************/
 /* Global Proxy API                                                       */
 /**************************************************************************/
 
diff --git a/libpurple/proxy.c b/libpurple/proxy.c
--- a/libpurple/proxy.c
+++ b/libpurple/proxy.c
@@ -33,143 +33,9 @@
 #include <gio/gio.h>
 #include <libsoup/soup.h>
 
-struct _PurpleProxyInfo
-{
-	PurpleProxyType type; /* The proxy type.  */
-
-	char *host;           /* The host.        */
-	int   port;           /* The port number. */
-	char *username;       /* The username.    */
-	char *password;       /* The password.    */
-};
-
 static PurpleProxyInfo *global_proxy_info = NULL;
 
 /**************************************************************************
- * Proxy structure API
- **************************************************************************/
-PurpleProxyInfo *
-purple_proxy_info_new(void)
-{
-	return g_new0(PurpleProxyInfo, 1);
-}
-
-static PurpleProxyInfo *
-purple_proxy_info_copy(PurpleProxyInfo *info)
-{
-	PurpleProxyInfo *copy;
-
-	g_return_val_if_fail(info != NULL, NULL);
-
-	copy = purple_proxy_info_new();
-	copy->type = info->type;
-	copy->host = g_strdup(info->host);
-	copy->port = info->port;
-	copy->username = g_strdup(info->username);
-	copy->password = g_strdup(info->password);
-
-	return copy;
-}
-
-void
-purple_proxy_info_destroy(PurpleProxyInfo *info)
-{
-	g_return_if_fail(info != NULL);
-
-	g_free(info->host);
-	g_free(info->username);
-	g_free(info->password);
-
-	g_free(info);
-}
-
-void
-purple_proxy_info_set_proxy_type(PurpleProxyInfo *info, PurpleProxyType type)
-{
-	g_return_if_fail(info != NULL);
-
-	info->type = type;
-}
-
-void
-purple_proxy_info_set_host(PurpleProxyInfo *info, const char *host)
-{
-	g_return_if_fail(info != NULL);
-
-	g_free(info->host);
-	info->host = g_strdup(host);
-}
-
-void
-purple_proxy_info_set_port(PurpleProxyInfo *info, int port)
-{
-	g_return_if_fail(info != NULL);
-
-	info->port = port;
-}
-
-void
-purple_proxy_info_set_username(PurpleProxyInfo *info, const char *username)
-{
-	g_return_if_fail(info != NULL);
-
-	g_free(info->username);
-	info->username = g_strdup(username);
-}
-
-void
-purple_proxy_info_set_password(PurpleProxyInfo *info, const char *password)
-{
-	g_return_if_fail(info != NULL);
-
-	g_free(info->password);
-	info->password = g_strdup(password);
-}
-
-PurpleProxyType
-purple_proxy_info_get_proxy_type(const PurpleProxyInfo *info)
-{
-	g_return_val_if_fail(info != NULL, PURPLE_PROXY_NONE);
-
-	return info->type;
-}
-
-const char *
-purple_proxy_info_get_host(const PurpleProxyInfo *info)
-{
-	g_return_val_if_fail(info != NULL, NULL);
-
-	return info->host;
-}
-
-int
-purple_proxy_info_get_port(const PurpleProxyInfo *info)
-{
-	g_return_val_if_fail(info != NULL, 0);
-
-	return info->port;
-}
-
-const char *
-purple_proxy_info_get_username(const PurpleProxyInfo *info)
-{
-	g_return_val_if_fail(info != NULL, NULL);
-
-	return info->username;
-}
-
-const char *
-purple_proxy_info_get_password(const PurpleProxyInfo *info)
-{
-	g_return_val_if_fail(info != NULL, NULL);
-
-	return info->password;
-}
-
-G_DEFINE_BOXED_TYPE(PurpleProxyInfo, purple_proxy_info,
-		purple_proxy_info_copy, purple_proxy_info_destroy);
-
-/**************************************************************************
  * Global Proxy API
  **************************************************************************/
 PurpleProxyInfo *
@@ -183,341 +49,11 @@
 {
 	g_return_if_fail(info != NULL);
 
-	purple_proxy_info_destroy(global_proxy_info);
+	g_clear_object(&global_proxy_info);
 
 	global_proxy_info = info;
 }
 
-
-/* index in gproxycmds below, keep them in sync */
-#define GNOME_PROXY_MODE 0
-#define GNOME_PROXY_USE_SAME_PROXY 1
-#define GNOME_PROXY_SOCKS_HOST 2
-#define GNOME_PROXY_SOCKS_PORT 3
-#define GNOME_PROXY_HTTP_HOST 4
-#define GNOME_PROXY_HTTP_PORT 5
-#define GNOME_PROXY_HTTP_USER 6
-#define GNOME_PROXY_HTTP_PASS 7
-#define GNOME2_CMDS 0
-#define GNOME3_CMDS 1
-
-/* detect proxy settings for gnome2/gnome3 */
-static const char* gproxycmds[][2] = {
-	{ "gconftool-2 -g /system/proxy/mode" , "gsettings get org.gnome.system.proxy mode" },
-	{ "gconftool-2 -g /system/http_proxy/use_same_proxy", "gsettings get org.gnome.system.proxy use-same-proxy" },
-	{ "gconftool-2 -g /system/proxy/socks_host", "gsettings get org.gnome.system.proxy.socks host" },
-	{ "gconftool-2 -g /system/proxy/socks_port", "gsettings get org.gnome.system.proxy.socks port" },
-	{ "gconftool-2 -g /system/http_proxy/host", "gsettings get org.gnome.system.proxy.http host" },
-	{ "gconftool-2 -g /system/http_proxy/port", "gsettings get org.gnome.system.proxy.http port"},
-	{ "gconftool-2 -g /system/http_proxy/authentication_user", "gsettings get org.gnome.system.proxy.http authentication-user" },
-	{ "gconftool-2 -g /system/http_proxy/authentication_password", "gsettings get org.gnome.system.proxy.http authentication-password" },
-};
-
-/*
- * purple_gnome_proxy_get_parameter:
- * @parameter:     One of the GNOME_PROXY_x constants defined above
- * @gnome_version: GNOME2_CMDS or GNOME3_CMDS
- *
- * This is a utility function used to retrieve proxy parameter values from
- * GNOME 2/3 environment.
- *
- * Returns: The value of requested proxy parameter
- */
-static char *
-purple_gnome_proxy_get_parameter(guint8 parameter, guint8 gnome_version)
-{
-	gchar *param, *err;
-	size_t param_len;
-
-	if (parameter > GNOME_PROXY_HTTP_PASS)
-		return NULL;
-	if (gnome_version > GNOME3_CMDS)
-		return NULL;
-
-	if (!g_spawn_command_line_sync(gproxycmds[parameter][gnome_version],
-			&param, &err, NULL, NULL))
-		return NULL;
-	g_free(err);
-
-	g_strstrip(param);
-	if (param[0] == '\'' || param[0] == '\"') {
-		param_len = strlen(param);
-		memmove(param, param + 1, param_len); /* copy last \0 too */
-		--param_len;
-		if (param_len > 0 && (param[param_len - 1] == '\'' || param[param_len - 1] == '\"'))
-			param[param_len - 1] = '\0';
-		g_strstrip(param);
-	}
-
-	return param;
-}
-
-static PurpleProxyInfo *
-purple_gnome_proxy_get_info(void)
-{
-	static PurpleProxyInfo info = {0, NULL, 0, NULL, NULL};
-	gboolean use_same_proxy = FALSE;
-	gchar *tmp;
-	guint8 gnome_version = GNOME3_CMDS;
-
-	tmp = g_find_program_in_path("gsettings");
-	if (tmp == NULL) {
-		tmp = g_find_program_in_path("gconftool-2");
-		gnome_version = GNOME2_CMDS;
-	}
-	if (tmp == NULL)
-		return purple_global_proxy_get_info();
-
-	g_free(tmp);
-
-	/* Check whether to use a proxy. */
-	tmp = purple_gnome_proxy_get_parameter(GNOME_PROXY_MODE, gnome_version);
-	if (!tmp)
-		return purple_global_proxy_get_info();
-
-	if (purple_strequal(tmp, "none")) {
-		info.type = PURPLE_PROXY_NONE;
-		g_free(tmp);
-		return &info;
-	}
-
-	if (!purple_strequal(tmp, "manual")) {
-		/* Unknown setting.  Fallback to using our global proxy settings. */
-		g_free(tmp);
-		return purple_global_proxy_get_info();
-	}
-
-	g_free(tmp);
-
-	/* Free the old fields */
-	g_free(info.host);
-	info.host = NULL;
-	g_free(info.username);
-	info.username = NULL;
-	g_free(info.password);
-	info.password = NULL;
-
-	tmp = purple_gnome_proxy_get_parameter(GNOME_PROXY_USE_SAME_PROXY, gnome_version);
-	if (!tmp)
-		return purple_global_proxy_get_info();
-
-	if (purple_strequal(tmp, "true"))
-		use_same_proxy = TRUE;
-
-	g_free(tmp);
-
-	if (!use_same_proxy) {
-		info.host = purple_gnome_proxy_get_parameter(GNOME_PROXY_SOCKS_HOST, gnome_version);
-		if (!info.host)
-			return purple_global_proxy_get_info();
-	}
-
-	if (!use_same_proxy && (info.host != NULL) && (*info.host != '\0')) {
-		info.type = PURPLE_PROXY_SOCKS5;
-		tmp = purple_gnome_proxy_get_parameter(GNOME_PROXY_SOCKS_PORT, gnome_version);
-		if (!tmp) {
-			g_free(info.host);
-			info.host = NULL;
-			return purple_global_proxy_get_info();
-		}
-		info.port = atoi(tmp);
-		g_free(tmp);
-	} else {
-		g_free(info.host);
-		info.host = purple_gnome_proxy_get_parameter(GNOME_PROXY_HTTP_HOST, gnome_version);
-		if (!info.host)
-			return purple_global_proxy_get_info();
-
-		/* If we get this far then we know we're using an HTTP proxy */
-		info.type = PURPLE_PROXY_HTTP;
-
-		if (*info.host == '\0')
-		{
-			purple_debug_info("proxy", "Gnome proxy settings are set to "
-					"'manual' but no suitable proxy server is specified.  Using "
-					"Pidgin's proxy settings instead.\n");
-			g_free(info.host);
-			info.host = NULL;
-			return purple_global_proxy_get_info();
-		}
-
-		info.username = purple_gnome_proxy_get_parameter(GNOME_PROXY_HTTP_USER, gnome_version);
-		if (!info.username)
-		{
-			g_free(info.host);
-			info.host = NULL;
-			return purple_global_proxy_get_info();
-		}
-
-		info.password = purple_gnome_proxy_get_parameter(GNOME_PROXY_HTTP_PASS, gnome_version);
-		if (!info.password)
-		{
-			g_free(info.host);
-			info.host = NULL;
-			g_free(info.username);
-			info.username = NULL;
-			return purple_global_proxy_get_info();
-		}
-
-		tmp = purple_gnome_proxy_get_parameter(GNOME_PROXY_HTTP_PORT, gnome_version);
-		if (!tmp)
-		{
-			g_free(info.host);
-			info.host = NULL;
-			g_free(info.username);
-			info.username = NULL;
-			g_free(info.password);
-			info.password = NULL;
-			return purple_global_proxy_get_info();
-		}
-		info.port = atoi(tmp);
-		g_free(tmp);
-	}
-
-	return &info;
-}
-
-#ifdef _WIN32
-
-typedef BOOL (CALLBACK* LPFNWINHTTPGETIEPROXYCONFIG)(/*IN OUT*/ WINHTTP_CURRENT_USER_IE_PROXY_CONFIG* pProxyConfig);
-
-/* This modifies "host" in-place evilly */
-static void
-_proxy_fill_hostinfo(PurpleProxyInfo *info, char *host, int default_port)
-{
-	int port = default_port;
-	char *d;
-
-	d = g_strrstr(host, ":");
-	if (d) {
-		*d = '\0';
-
-		d++;
-		if (*d)
-			sscanf(d, "%d", &port);
-
-		if (port == 0)
-			port = default_port;
-	}
-
-	purple_proxy_info_set_host(info, host);
-	purple_proxy_info_set_port(info, port);
-}
-
-static PurpleProxyInfo *
-purple_win32_proxy_get_info(void)
-{
-	static LPFNWINHTTPGETIEPROXYCONFIG MyWinHttpGetIEProxyConfig = NULL;
-	static gboolean loaded = FALSE;
-	static PurpleProxyInfo info = {0, NULL, 0, NULL, NULL};
-
-	WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ie_proxy_config;
-
-	if (!loaded) {
-		loaded = TRUE;
-		MyWinHttpGetIEProxyConfig = (LPFNWINHTTPGETIEPROXYCONFIG)
-			wpurple_find_and_loadproc("winhttp.dll", "WinHttpGetIEProxyConfigForCurrentUser");
-		if (!MyWinHttpGetIEProxyConfig)
-			purple_debug_warning("proxy", "Unable to read Windows Proxy Settings.\n");
-	}
-
-	if (!MyWinHttpGetIEProxyConfig)
-		return NULL;
-
-	ZeroMemory(&ie_proxy_config, sizeof(ie_proxy_config));
-	if (!MyWinHttpGetIEProxyConfig(&ie_proxy_config)) {
-		purple_debug_error("proxy", "Error reading Windows Proxy Settings(%lu).\n", GetLastError());
-		return NULL;
-	}
-
-	/* We can't do much if it is autodetect*/
-	if (ie_proxy_config.fAutoDetect) {
-		purple_debug_error("proxy", "Windows Proxy Settings set to autodetect (not supported).\n");
-
-		/* TODO: For 3.0.0 we'll revisit this (maybe)*/
-
-		return NULL;
-
-	} else if (ie_proxy_config.lpszProxy) {
-		gchar *proxy_list = g_utf16_to_utf8(ie_proxy_config.lpszProxy, -1,
-									 NULL, NULL, NULL);
-
-		/* We can't do anything about the bypass list, as we don't have the url */
-		/* TODO: For 3.0.0 we'll revisit this*/
-
-		/* There are proxy settings for several protocols */
-		if (proxy_list && *proxy_list) {
-			char *specific = NULL, *tmp;
-
-			/* If there is only a global proxy, which  means "HTTP" */
-			if (!strchr(proxy_list, ';') || (specific = g_strstr_len(proxy_list, -1, "http=")) != NULL) {
-
-				if (specific) {
-					specific += strlen("http=");
-					tmp = strchr(specific, ';');
-					if (tmp)
-						*tmp = '\0';
-					/* specific now points the proxy server (and port) */
-				} else
-					specific = proxy_list;
-
-				purple_proxy_info_set_proxy_type(&info, PURPLE_PROXY_HTTP);
-				_proxy_fill_hostinfo(&info, specific, 80);
-				/* TODO: is there a way to set the username/password? */
-				purple_proxy_info_set_username(&info, NULL);
-				purple_proxy_info_set_password(&info, NULL);
-
-				purple_debug_info("proxy", "Windows Proxy Settings: HTTP proxy: '%s:%d'.\n",
-								  purple_proxy_info_get_host(&info),
-								  purple_proxy_info_get_port(&info));
-
-			} else if ((specific = g_strstr_len(proxy_list, -1, "socks=")) != NULL) {
-
-				specific += strlen("socks=");
-				tmp = strchr(specific, ';');
-				if (tmp)
-					*tmp = '\0';
-				/* specific now points the proxy server (and port) */
-
-				purple_proxy_info_set_proxy_type(&info, PURPLE_PROXY_SOCKS5);
-				_proxy_fill_hostinfo(&info, specific, 1080);
-				/* TODO: is there a way to set the username/password? */
-				purple_proxy_info_set_username(&info, NULL);
-				purple_proxy_info_set_password(&info, NULL);
-
-				purple_debug_info("proxy", "Windows Proxy Settings: SOCKS5 proxy: '%s:%d'.\n",
-								  purple_proxy_info_get_host(&info),
-								  purple_proxy_info_get_port(&info));
-
-			} else {
-
-				purple_debug_info("proxy", "Windows Proxy Settings: No supported proxy specified.\n");
-
-				purple_proxy_info_set_proxy_type(&info, PURPLE_PROXY_NONE);
-
-			}
-		}
-
-		/* TODO: Fix API to be able look at proxy bypass settings */
-
-		g_free(proxy_list);
-	} else {
-		purple_debug_info("proxy", "No Windows proxy set.\n");
-		purple_proxy_info_set_proxy_type(&info, PURPLE_PROXY_NONE);
-	}
-
-	if (ie_proxy_config.lpszAutoConfigUrl)
-		GlobalFree(ie_proxy_config.lpszAutoConfigUrl);
-	if (ie_proxy_config.lpszProxy)
-		GlobalFree(ie_proxy_config.lpszProxy);
-	if (ie_proxy_config.lpszProxyBypass)
-		GlobalFree(ie_proxy_config.lpszProxyBypass);
-
-	return &info;
-}
-#endif
-
-
 /**************************************************************************
  * Proxy API
  **************************************************************************/
@@ -532,22 +68,19 @@
 	static PurpleProxyInfo *tmp_none_proxy_info = NULL;
 	if (!tmp_none_proxy_info) {
 		tmp_none_proxy_info = purple_proxy_info_new();
-		purple_proxy_info_set_proxy_type(tmp_none_proxy_info, PURPLE_PROXY_NONE);
+		purple_proxy_info_set_proxy_type(tmp_none_proxy_info, PURPLE_PROXY_TYPE_NONE);
 	}
 
 	if (account && purple_account_get_proxy_info(account) != NULL) {
 		gpi = purple_account_get_proxy_info(account);
-		if (purple_proxy_info_get_proxy_type(gpi) == PURPLE_PROXY_USE_GLOBAL)
+		if (purple_proxy_info_get_proxy_type(gpi) == PURPLE_PROXY_TYPE_USE_GLOBAL)
 			gpi = NULL;
 	}
 	if (gpi == NULL) {
-		if (purple_running_gnome())
-			gpi = purple_gnome_proxy_get_info();
-		else
-			gpi = purple_global_proxy_get_info();
+		gpi = purple_global_proxy_get_info();
 	}
 
-	if (purple_proxy_info_get_proxy_type(gpi) == PURPLE_PROXY_USE_ENVVAR) {
+	if (purple_proxy_info_get_proxy_type(gpi) == PURPLE_PROXY_TYPE_USE_ENVVAR) {
 		if ((tmp = g_getenv("HTTP_PROXY")) != NULL ||
 			(tmp = g_getenv("http_proxy")) != NULL ||
 			(tmp = g_getenv("HTTPPROXY")) != NULL)
@@ -575,10 +108,10 @@
 				return gpi;
 			}
 
-			purple_proxy_info_set_host(gpi, host);
+			purple_proxy_info_set_hostname(gpi, host);
+			purple_proxy_info_set_port(gpi, port);
 			purple_proxy_info_set_username(gpi, username);
 			purple_proxy_info_set_password(gpi, password);
-			purple_proxy_info_set_port(gpi, port);
 
 			g_free(host);
 			g_free(username);
@@ -600,11 +133,6 @@
 				(tmp = g_getenv("HTTPPROXYPORT")) != NULL)
 				purple_proxy_info_set_port(gpi, atoi(tmp));
 		} else {
-#ifdef _WIN32
-			PurpleProxyInfo *wgpi;
-			if ((wgpi = purple_win32_proxy_get_info()) != NULL)
-				return wgpi;
-#endif
 			/* no proxy environment variable found, don't use a proxy */
 			purple_debug_info("proxy", "No environment settings found, not using a proxy\n");
 			gpi = tmp_none_proxy_info;
@@ -626,7 +154,7 @@
 	gchar *proxy;
 	GProxyResolver *resolver;
 
-	if (purple_proxy_info_get_proxy_type(info) == PURPLE_PROXY_NONE) {
+	if (purple_proxy_info_get_proxy_type(info) == PURPLE_PROXY_TYPE_NONE) {
 		/* Return an empty simple resolver, which will resolve on direct
 		 * connection. */
 		return g_simple_proxy_resolver_new(NULL, NULL);
@@ -636,17 +164,17 @@
 	{
 		/* PURPLE_PROXY_NONE already handled above */
 
-		case PURPLE_PROXY_USE_ENVVAR:
+		case PURPLE_PROXY_TYPE_USE_ENVVAR:
 			/* Intentional passthrough */
-		case PURPLE_PROXY_HTTP:
+		case PURPLE_PROXY_TYPE_HTTP:
 			protocol = "http";
 			break;
-		case PURPLE_PROXY_SOCKS4:
+		case PURPLE_PROXY_TYPE_SOCKS4:
 			protocol = "socks4";
 			break;
-		case PURPLE_PROXY_SOCKS5:
+		case PURPLE_PROXY_TYPE_SOCKS5:
 			/* Intentional passthrough */
-		case PURPLE_PROXY_TOR:
+		case PURPLE_PROXY_TYPE_TOR:
 			protocol = "socks5";
 			break;
 
@@ -659,7 +187,7 @@
 	}
 
 
-	if (purple_proxy_info_get_host(info) == NULL ||
+	if (purple_proxy_info_get_hostname(info) == NULL ||
 			purple_proxy_info_get_port(info) <= 0) {
 		g_set_error_literal(error, PURPLE_CONNECTION_ERROR,
 				PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,
@@ -687,7 +215,7 @@
 
 	proxy = g_strdup_printf("%s://%s%s:%i", protocol,
 			auth != NULL ? auth : "",
-			purple_proxy_info_get_host(info),
+			purple_proxy_info_get_hostname(info),
 			purple_proxy_info_get_port(info));
 	g_free(auth);
 
@@ -708,23 +236,23 @@
 		const char *type = value;
 
 		if (purple_strequal(type, "none"))
-			proxytype = PURPLE_PROXY_NONE;
+			proxytype = PURPLE_PROXY_TYPE_NONE;
 		else if (purple_strequal(type, "http"))
-			proxytype = PURPLE_PROXY_HTTP;
+			proxytype = PURPLE_PROXY_TYPE_HTTP;
 		else if (purple_strequal(type, "socks4"))
-			proxytype = PURPLE_PROXY_SOCKS4;
+			proxytype = PURPLE_PROXY_TYPE_SOCKS4;
 		else if (purple_strequal(type, "socks5"))
-			proxytype = PURPLE_PROXY_SOCKS5;
+			proxytype = PURPLE_PROXY_TYPE_SOCKS5;
 		else if (purple_strequal(type, "tor"))
-			proxytype = PURPLE_PROXY_TOR;
+			proxytype = PURPLE_PROXY_TYPE_TOR;
 		else if (purple_strequal(type, "envvar"))
-			proxytype = PURPLE_PROXY_USE_ENVVAR;
+			proxytype = PURPLE_PROXY_TYPE_USE_ENVVAR;
 		else
 			proxytype = -1;
 
 		purple_proxy_info_set_proxy_type(info, proxytype);
 	} else if (purple_strequal(name, "/purple/proxy/host"))
-		purple_proxy_info_set_host(info, value);
+		purple_proxy_info_set_hostname(info, value);
 	else if (purple_strequal(name, "/purple/proxy/port"))
 		purple_proxy_info_set_port(info, GPOINTER_TO_INT(value));
 	else if (purple_strequal(name, "/purple/proxy/username"))
@@ -784,6 +312,5 @@
 {
 	purple_prefs_disconnect_by_handle(purple_proxy_get_handle());
 
-	purple_proxy_info_destroy(global_proxy_info);
-	global_proxy_info = NULL;
+	g_clear_object(&global_proxy_info);
 }
diff --git a/libpurple/purpleproxyinfo.h b/libpurple/purpleproxyinfo.h
new file mode 100644
--- /dev/null
+++ b/libpurple/purpleproxyinfo.h
@@ -0,0 +1,167 @@
+/*
+ * Purple - Internet Messaging Library
+ * Copyright (C) Pidgin Developers <devel@pidgin.im>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
+ */
+
+#if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
+# error "only <purple.h> may be included directly"
+#endif
+
+#ifndef PURPLE_PROXY_INFO_H
+#define PURPLE_PROXY_INFO_H
+
+#include <glib.h>
+#include <glib-object.h>
+
+/**
+ * PurpleProxyType:
+ * @PURPLE_PROXY_TYPE_USE_GLOBAL: Use the global proxy information.
+ * @PURPLE_PROXY_TYPE_NONE:  No proxy.
+ * @PURPLE_PROXY_TYPE_HTTP: HTTP proxy.
+ * @PURPLE_PROXY_TYPE_SOCKS4: SOCKS 4 proxy.
+ * @PURPLE_PROXY_TYPE_SOCKS5: SOCKS 5 proxy.
+ * @PURPLE_PROXY_TYPE_USE_ENVVAR: Use environmental settings.
+ * @PURPLE_PROXY_TYPE_TOR: Use a Tor proxy (SOCKS 5 really).
+ *
+ * A type of proxy connection.
+ */
+typedef enum {
+    PURPLE_PROXY_TYPE_USE_GLOBAL = -1,
+    PURPLE_PROXY_TYPE_NONE = 0,
+    PURPLE_PROXY_TYPE_HTTP,
+    PURPLE_PROXY_TYPE_SOCKS4,
+    PURPLE_PROXY_TYPE_SOCKS5,
+    PURPLE_PROXY_TYPE_USE_ENVVAR,
+    PURPLE_PROXY_TYPE_TOR
+} PurpleProxyType;
+
+G_BEGIN_DECLS
+
+#define PURPLE_TYPE_PROXY_INFO (purple_proxy_info_get_type())
+G_DECLARE_FINAL_TYPE(PurpleProxyInfo, purple_proxy_info, PURPLE, PROXY_INFO,
+                     GObject)
+
+/**
+ * purple_proxy_info_new:
+ *
+ * Creates a new proxy info instance.
+ *
+ * Returns: (transfer full): The new instance.
+ */
+PurpleProxyInfo *purple_proxy_info_new(void);
+
+/**
+ * purple_proxy_info_set_proxy_type:
+ * @info: The instance.
+ * @type: The new type.
+ *
+ * Sets the type of @info.
+ */
+void purple_proxy_info_set_proxy_type(PurpleProxyInfo *info, PurpleProxyType proxy_type);
+
+/**
+ * purple_proxy_info_get_proxy_type:
+ * @info: The instance.
+ *
+ * Gets the type of the proxy.
+ *
+ * Returns: The type of the proxy.
+ */
+PurpleProxyType purple_proxy_info_get_proxy_type(PurpleProxyInfo *info);
+
+/**
+ * purple_proxy_info_set_hostname:
+ * @info: The instance.
+ * @hostname: The new hostname.
+ *
+ * Sets the hostname for the proxy.
+ *
+ * Since: 3.0.0
+ */
+void purple_proxy_info_set_hostname(PurpleProxyInfo *info, const gchar *hostname);
+
+/**
+ * purple_proxy_info_get_hostname:
+ * @info: The instance.
+ *
+ * Gets the hostname of the proxy.
+ *
+ * Return: The hostname.
+ *
+ * Since: 3.0.0
+ */
+const gchar *purple_proxy_info_get_hostname(PurpleProxyInfo *info);
+
+/**
+ * purple_proxy_info_set_port:
+ * @info: The instance.
+ * @port: The new port.
+ *
+ * Sets the port for the proxy.
+ */
+void purple_proxy_info_set_port(PurpleProxyInfo *info, gint port);
+
+/**
+ * purple_proxy_info_get_port:
+ * @info: The instance.
+ *
+ * Gets the port of the proxy.
+ *
+ * Returns: The port of the proxy.
+ */
+gint purple_proxy_info_get_port(PurpleProxyInfo *info);
+
+/**
+ * purple_proxy_info_set_username:
+ * @info: The instance.
+ * @username: The new username.
+ *
+ * Sets the username of the proxy.
+ */
+void purple_proxy_info_set_username(PurpleProxyInfo *info, const gchar *username);
+
+/**
+ * purple_proxy_info_get_username:
+ * @info: The instance.
+ *
+ * Gets the username of the proxy.
+ *
+ * Returns: The username of the proxy.
+ */
+const gchar *purple_proxy_info_get_username(PurpleProxyInfo *info);
+
+/**
+ * purple_proxy_info_set_password:
+ * @info: The instance:
+ * @password: The new password.
+ *
+ * Sets the password for the proxy.
+ */
+void purple_proxy_info_set_password(PurpleProxyInfo *info, const gchar *password);
+
+/**
+ * purple_proxy_info_get_password:
+ * @info: The instance.
+ *
+ * Gets the password of the proxy.
+ *
+ * Returns: The password of the proxy.
+ */
+const gchar *purple_proxy_info_get_password(PurpleProxyInfo *info);
+
+G_END_DECLS
+
+#endif /* PURPLE_PROXY_INFO_H */
diff --git a/libpurple/purpleproxyinfo.c b/libpurple/purpleproxyinfo.c
new file mode 100644
--- /dev/null
+++ b/libpurple/purpleproxyinfo.c
@@ -0,0 +1,289 @@
+/*
+ * Purple - Internet Messaging Library
+ * Copyright (C) Pidgin Developers <devel@pidgin.im>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "purpleproxyinfo.h"
+
+#include "purpleenums.h"
+
+struct _PurpleProxyInfo {
+    GObject parent;
+
+    PurpleProxyType proxy_type;
+    gchar *hostname;
+    gint port;
+    gchar *username;
+    gchar *password;
+};
+
+enum {
+    PROP_0,
+    PROP_PROXY_TYPE,
+    PROP_HOSTNAME,
+    PROP_PORT,
+    PROP_USERNAME,
+    PROP_PASSWORD,
+    N_PROPERTIES
+};
+static GParamSpec *properties[N_PROPERTIES] = {NULL, };
+
+G_DEFINE_TYPE(PurpleProxyInfo, purple_proxy_info, G_TYPE_OBJECT)
+
+/******************************************************************************
+ * GObject Implementation
+ *****************************************************************************/
+static void
+purple_proxy_info_get_property(GObject *obj, guint param_id, GValue *value,
+                               GParamSpec *pspec)
+{
+    PurpleProxyInfo *info = PURPLE_PROXY_INFO(obj);
+
+    switch(param_id) {
+        case PROP_PROXY_TYPE:
+            g_value_set_enum(value, purple_proxy_info_get_proxy_type(info));
+            break;
+        case PROP_HOSTNAME:
+            g_value_set_string(value, purple_proxy_info_get_hostname(info));
+            break;
+        case PROP_PORT:
+            g_value_set_int(value, purple_proxy_info_get_port(info));
+            break;
+        case PROP_USERNAME:
+            g_value_set_string(value, purple_proxy_info_get_username(info));
+            break;
+        case PROP_PASSWORD:
+            g_value_set_string(value, purple_proxy_info_get_password(info));
+            break;
+        default:
+            G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
+            break;
+    }
+}
+
+static void
+purple_proxy_info_set_property(GObject *obj, guint param_id,
+                               const GValue *value, GParamSpec *pspec)
+{
+    PurpleProxyInfo *info = PURPLE_PROXY_INFO(obj);
+
+    switch(param_id) {
+        case PROP_PROXY_TYPE:
+            purple_proxy_info_set_proxy_type(info, g_value_get_enum(value));
+            break;
+        case PROP_HOSTNAME:
+            purple_proxy_info_set_hostname(info, g_value_get_string(value));
+            break;
+        case PROP_PORT:
+            purple_proxy_info_set_port(info, g_value_get_int(value));
+            break;
+        case PROP_USERNAME:
+            purple_proxy_info_set_username(info, g_value_get_string(value));
+            break;
+        case PROP_PASSWORD:
+            purple_proxy_info_set_password(info, g_value_get_string(value));
+            break;
+        default:
+            G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
+            break;
+    }
+}
+
+static void
+purple_proxy_info_finalize(GObject *obj) {
+    PurpleProxyInfo *info = PURPLE_PROXY_INFO(obj);
+
+    g_free(info->hostname);
+    g_free(info->username);
+    g_free(info->password);
+
+    G_OBJECT_CLASS(purple_proxy_info_parent_class)->finalize(obj);
+}
+
+static void
+purple_proxy_info_init(PurpleProxyInfo *info) {
+}
+
+static void
+purple_proxy_info_class_init(PurpleProxyInfoClass *klass) {
+    GObjectClass *obj_class = G_OBJECT_CLASS(klass);
+
+    obj_class->get_property = purple_proxy_info_get_property;
+    obj_class->set_property = purple_proxy_info_set_property;
+    obj_class->finalize = purple_proxy_info_finalize;
+
+    /**
+     * PurpleProxyInfo::proxy-type:
+     *
+     * The [enum@ProxyType] to use for this proxy.
+     *
+     * Since: 3.0.0
+     */
+    properties[PROP_PROXY_TYPE] = g_param_spec_enum(
+        "proxy-type", "proxy-type",
+        "The proxy type for this proxy.",
+        PURPLE_TYPE_PROXY_TYPE,
+        PURPLE_PROXY_TYPE_USE_GLOBAL,
+        G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+    /**
+     * PurpleProxyInfo::hostname:
+     *
+     * The hostname to use for this proxy.
+     *
+     * Since: 3.0.0
+     */
+    properties[PROP_HOSTNAME] = g_param_spec_string(
+        "hostname", "hostname",
+        "The hostname for this proxy.",
+        NULL,
+        G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+    /**
+     * PurpleProxyInfo::port:
+     *
+     * The port to use for this proxy.
+     *
+     * Since: 3.0.0
+     */
+    properties[PROP_PORT] = g_param_spec_int(
+        "hostname", "hostname",
+        "The hostname for this proxy.",
+        0, 65535, 0,
+        G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+    /**
+     * PurpleProxyInfo::username:
+     *
+     * The username to use for this proxy.
+     *
+     * Since: 3.0.0
+     */
+    properties[PROP_USERNAME] = g_param_spec_string(
+        "username", "username",
+        "The username for this proxy.",
+        NULL,
+        G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+    /**
+     * PurpleProxyInfo::password:
+     *
+     * The password to use for this proxy.
+     *
+     * Since: 3.0.0
+     */
+    properties[PROP_PASSWORD] = g_param_spec_string(
+        "password", "password",
+        "The password for this proxy.",
+        NULL,
+        G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+
+    g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
+}
+
+/******************************************************************************
+ * Public API
+ *****************************************************************************/
+PurpleProxyInfo *
+purple_proxy_info_new(void) {
+    return g_object_new(PURPLE_TYPE_PROXY_INFO, NULL);
+}
+
+void
+purple_proxy_info_set_proxy_type(PurpleProxyInfo *info,
+                                 PurpleProxyType proxy_type)
+{
+    g_return_if_fail(PURPLE_IS_PROXY_INFO(info));
+
+    info->proxy_type = proxy_type;
+
+    g_object_notify_by_pspec(G_OBJECT(info), properties[PROP_PROXY_TYPE]);
+}
+
+PurpleProxyType
+purple_proxy_info_get_proxy_type(PurpleProxyInfo *info) {
+    g_return_val_if_fail(PURPLE_IS_PROXY_INFO(info), PURPLE_PROXY_TYPE_NONE);
+
+    return info->proxy_type;
+}
+
+void
+purple_proxy_info_set_hostname(PurpleProxyInfo *info, const gchar *hostname) {
+    g_return_if_fail(PURPLE_IS_PROXY_INFO(info));
+
+    g_free(info->hostname);
+    info->hostname = g_strdup(hostname);
+
+    g_object_notify_by_pspec(G_OBJECT(info), properties[PROP_HOSTNAME]);
+}
+
+const gchar *
+purple_proxy_info_get_hostname(PurpleProxyInfo *info) {
+    g_return_val_if_fail(PURPLE_IS_PROXY_INFO(info), NULL);
+
+    return info->hostname;
+}
+
+void
+purple_proxy_info_set_port(PurpleProxyInfo *info, gint port) {
+    g_return_if_fail(PURPLE_IS_PROXY_INFO(info));
+
+    info->port = port;
+
+    g_object_notify_by_pspec(G_OBJECT(info), properties[PROP_PORT]);
+}
+
+gint
+purple_proxy_info_get_port(PurpleProxyInfo *info) {
+    g_return_val_if_fail(PURPLE_IS_PROXY_INFO(info), 0);
+
+    return info->port;
+}
+
+void
+purple_proxy_info_set_username(PurpleProxyInfo *info, const gchar *username) {
+    g_return_if_fail(PURPLE_IS_PROXY_INFO(info));
+
+    g_free(info->username);
+    info->username = g_strdup(username);
+
+    g_object_notify_by_pspec(G_OBJECT(info), properties[PROP_USERNAME]);
+}
+
+const gchar *
+purple_proxy_info_get_username(PurpleProxyInfo *info) {
+    g_return_val_if_fail(PURPLE_IS_PROXY_INFO(info), NULL);
+
+    return info->username;
+}
+
+void
+purple_proxy_info_set_password(PurpleProxyInfo *info, const gchar *password) {
+    g_return_if_fail(PURPLE_IS_PROXY_INFO(info));
+
+    g_free(info->password);
+    info->password = g_strdup(password);
+
+    g_object_notify_by_pspec(G_OBJECT(info), properties[PROP_PASSWORD]);
+}
+
+const gchar *
+purple_proxy_info_get_password(PurpleProxyInfo *info) {
+    g_return_val_if_fail(PURPLE_IS_PROXY_INFO(info), NULL);
+
+    return info->password;
+}
diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c
--- a/pidgin/gtkaccount.c
+++ b/pidgin/gtkaccount.c
@@ -934,43 +934,43 @@
 	gtk_list_store_set(model, &iter,
 			0, purple_running_gnome() ? _("Use GNOME Proxy Settings")
 			:_("Use Global Proxy Settings"),
-			1, PURPLE_PROXY_USE_GLOBAL,
+			1, PURPLE_PROXY_TYPE_USE_GLOBAL,
 			-1);
 
 	gtk_list_store_append(model, &iter);
 	gtk_list_store_set(model, &iter,
 			0, _("No Proxy"),
-			1, PURPLE_PROXY_NONE,
+			1, PURPLE_PROXY_TYPE_NONE,
 			-1);
 
 	gtk_list_store_append(model, &iter);
 	gtk_list_store_set(model, &iter,
 			0, _("SOCKS 4"),
-			1, PURPLE_PROXY_SOCKS4,
+			1, PURPLE_PROXY_TYPE_SOCKS4,
 			-1);
 
 	gtk_list_store_append(model, &iter);
 	gtk_list_store_set(model, &iter,
 			0, _("SOCKS 5"),
-			1, PURPLE_PROXY_SOCKS5,
+			1, PURPLE_PROXY_TYPE_SOCKS5,
 			-1);
 
 	gtk_list_store_append(model, &iter);
 	gtk_list_store_set(model, &iter,
 			0, _("Tor/Privacy (SOCKS5)"),
-			1, PURPLE_PROXY_TOR,
+			1, PURPLE_PROXY_TYPE_TOR,
 			-1);
 
 	gtk_list_store_append(model, &iter);
 	gtk_list_store_set(model, &iter,
 			0, _("HTTP"),
-			1, PURPLE_PROXY_HTTP,
+			1, PURPLE_PROXY_TYPE_HTTP,
 			-1);
 
 	gtk_list_store_append(model, &iter);
 	gtk_list_store_set(model, &iter,
 			0, _("Use Environmental Settings"),
-			1, PURPLE_PROXY_USE_ENVVAR,
+			1, PURPLE_PROXY_TYPE_USE_ENVVAR,
 			-1);
 
 	renderer = gtk_cell_renderer_text_new();
@@ -993,9 +993,9 @@
 		dialog->new_proxy_type = int_value;
 	}
 
-	if (dialog->new_proxy_type == PURPLE_PROXY_USE_GLOBAL ||
-		dialog->new_proxy_type == PURPLE_PROXY_NONE ||
-		dialog->new_proxy_type == PURPLE_PROXY_USE_ENVVAR) {
+	if (dialog->new_proxy_type == PURPLE_PROXY_TYPE_USE_GLOBAL ||
+		dialog->new_proxy_type == PURPLE_PROXY_TYPE_NONE ||
+		dialog->new_proxy_type == PURPLE_PROXY_TYPE_USE_ENVVAR) {
 
 		gtk_widget_hide(dialog->proxy_vbox);
 	}
@@ -1082,7 +1082,7 @@
 
 		dialog->new_proxy_type = purple_proxy_info_get_proxy_type(proxy_info);
 
-		if ((value = purple_proxy_info_get_host(proxy_info)) != NULL)
+		if ((value = purple_proxy_info_get_hostname(proxy_info)) != NULL)
 			gtk_entry_set_text(GTK_ENTRY(dialog->proxy_host_entry), value);
 
 		if ((int_val = purple_proxy_info_get_port(proxy_info)) != 0) {
@@ -1100,7 +1100,7 @@
 			gtk_entry_set_text(GTK_ENTRY(dialog->proxy_pass_entry), value);
 
 	} else
-		dialog->new_proxy_type = PURPLE_PROXY_USE_GLOBAL;
+		dialog->new_proxy_type = PURPLE_PROXY_TYPE_USE_GLOBAL;
 
 	proxy_model = gtk_combo_box_get_model(
 		GTK_COMBO_BOX(dialog->proxy_dropdown));
@@ -1390,9 +1390,9 @@
 	value = gtk_entry_get_text(GTK_ENTRY(dialog->proxy_host_entry));
 
 	if (*value != '\0')
-		purple_proxy_info_set_host(proxy_info, value);
+		purple_proxy_info_set_hostname(proxy_info, value);
 	else
-		purple_proxy_info_set_host(proxy_info, NULL);
+		purple_proxy_info_set_hostname(proxy_info, NULL);
 
 	/* Port */
 	value = gtk_entry_get_text(GTK_ENTRY(dialog->proxy_port_entry));
@@ -1419,8 +1419,8 @@
 		purple_proxy_info_set_password(proxy_info, NULL);
 
 	/* If there are no values set then proxy_info NULL */
-	if ((purple_proxy_info_get_proxy_type(proxy_info) == PURPLE_PROXY_USE_GLOBAL) &&
-		(purple_proxy_info_get_host(proxy_info) == NULL) &&
+	if ((purple_proxy_info_get_proxy_type(proxy_info) == PURPLE_PROXY_TYPE_USE_GLOBAL) &&
+		(purple_proxy_info_get_hostname(proxy_info) == NULL) &&
 		(purple_proxy_info_get_port(proxy_info) == 0) &&
 		(purple_proxy_info_get_username(proxy_info) == NULL) &&
 		(purple_proxy_info_get_password(proxy_info) == NULL))
diff --git a/pidgin/prefs/pidginprefs.c b/pidgin/prefs/pidginprefs.c
--- a/pidgin/prefs/pidginprefs.c
+++ b/pidgin/prefs/pidginprefs.c
@@ -1039,9 +1039,9 @@
 				proxy_changed_cb, win);
 
 		if (proxy_info != NULL) {
-			if (purple_proxy_info_get_host(proxy_info)) {
+			if (purple_proxy_info_get_hostname(proxy_info)) {
 				gtk_entry_set_text(GTK_ENTRY(win->proxy.host),
-						purple_proxy_info_get_host(proxy_info));
+						purple_proxy_info_get_hostname(proxy_info));
 			}
 
 			if (purple_proxy_info_get_port(proxy_info) != 0) {
