summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-10-08 08:46:53 -0400
committerMatthew Barnes <mbarnes@redhat.com>2013-10-25 13:27:05 -0400
commit94c7b94561908485f8e667135ab9aa24ec1fdf76 (patch)
treec3970a3abc90e32ecf31e022c3305096431295c1 /services
parente4a2cdb121379f729b6a47145cd02cdc44962392 (diff)
downloadevolution-data-server-94c7b94561908485f8e667135ab9aa24ec1fdf76.tar.gz
Migrate proxy settings from Evolution.
Populate a ~/.config/evolution/sources/system-proxy.source file from the old "org.gnome.evolution.shell.network-config" schema on startup, and tag the schema keys as deprecated in their description fields.
Diffstat (limited to 'services')
-rw-r--r--services/evolution-source-registry/Makefile.am11
-rw-r--r--services/evolution-source-registry/evolution-source-registry-migrate-proxies.c137
-rw-r--r--services/evolution-source-registry/evolution-source-registry.c5
-rw-r--r--services/evolution-source-registry/org.gnome.evolution.shell.network-config.gschema.xml.in75
4 files changed, 228 insertions, 0 deletions
diff --git a/services/evolution-source-registry/Makefile.am b/services/evolution-source-registry/Makefile.am
index 65d8dd70d..e9fdb0954 100644
--- a/services/evolution-source-registry/Makefile.am
+++ b/services/evolution-source-registry/Makefile.am
@@ -24,20 +24,30 @@ builtin_sources = $(builtin_sources_in_files:.source.in=.source)
%.source: %.source.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po)
$(AM_V_GEN) $(MKDIR_P) builtin && LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
+gsettings_SCHEMAS = org.gnome.evolution.shell.network-config.gschema.xml
+@INTLTOOL_XML_NOMERGE_RULE@
+@GSETTINGS_RULES@
+
service_in_files = org.gnome.evolution.dataserver.Sources.service.in
servicedir = $(datadir)/dbus-1/services
service_DATA = $(service_in_files:.service.in=.service)
@EVO_SUBST_SERVICE_RULE@
+DISTCLEANFILES = \
+ $(gsettings_SCHEMAS) \
+ $(NULL)
+
CLEANFILES = \
$(BUILT_SOURCES) \
$(builtin_sources) \
+ $(gsettings_SCHEMAS:.xml=.valid) \
$(service_DATA) \
$(NULL)
EXTRA_DIST = \
evolution-source-registry-resource.xml \
$(builtin_sources_in_files) \
+ $(gsettings_SCHEMAS:.xml=.xml.in) \
$(service_in_files) \
$(NULL)
@@ -60,6 +70,7 @@ evolution_source_registry_SOURCES = \
$(BUILT_SOURCES) \
evolution-source-registry.c \
evolution-source-registry-migrate-basedir.c \
+ evolution-source-registry-migrate-proxies.c \
evolution-source-registry-migrate-sources.c \
evolution-source-registry-migrate-imap-to-imapx.c \
$(NULL)
diff --git a/services/evolution-source-registry/evolution-source-registry-migrate-proxies.c b/services/evolution-source-registry/evolution-source-registry-migrate-proxies.c
new file mode 100644
index 000000000..464708509
--- /dev/null
+++ b/services/evolution-source-registry/evolution-source-registry-migrate-proxies.c
@@ -0,0 +1,137 @@
+/*
+ * evolution-source-registry-migrate-proxies.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#include <config.h>
+#include <glib/gi18n-lib.h>
+
+#include <libebackend/libebackend.h>
+
+#define NETWORK_CONFIG_SCHEMA_ID "org.gnome.evolution.shell.network-config"
+
+/* Forward Declarations */
+void evolution_source_registry_migrate_proxies (ESourceRegistryServer *server);
+
+void
+evolution_source_registry_migrate_proxies (ESourceRegistryServer *server)
+{
+ GSettings *settings;
+ ESource *source;
+ ESourceProxy *extension;
+ EProxyMethod method;
+ const gchar *extension_name;
+ const gchar *user_dir;
+ gboolean system_proxy_exists;
+ gboolean v_bool;
+ gchar *filename;
+ gchar *string;
+ gchar **strv;
+ gint v_int;
+
+ g_return_if_fail (E_IS_SOURCE_REGISTRY_SERVER (server));
+
+ /* If a 'system-proxy.source' file already exists, leave it alone.
+ * Otherwise, populate the built-in proxy profile from Evolution's
+ * so-called "network-config" in GSettings. */
+
+ user_dir = e_server_side_source_get_user_dir ();
+ filename = g_build_filename (user_dir, "system-proxy.source", NULL);
+ system_proxy_exists = g_file_test (filename, G_FILE_TEST_IS_REGULAR);
+ g_free (filename);
+
+ if (system_proxy_exists)
+ return;
+
+ source = e_source_registry_server_ref_source (server, "system-proxy");
+ g_return_if_fail (source != NULL);
+
+ extension_name = E_SOURCE_EXTENSION_PROXY;
+ extension = e_source_get_extension (source, extension_name);
+
+ settings = g_settings_new (NETWORK_CONFIG_SCHEMA_ID);
+
+ switch (g_settings_get_int (settings, "proxy-type")) {
+ case 1:
+ method = E_PROXY_METHOD_NONE;
+ break;
+ case 2:
+ method = E_PROXY_METHOD_MANUAL;
+ break;
+ default:
+ method = E_PROXY_METHOD_DEFAULT;
+ break;
+ }
+
+ e_source_proxy_set_method (extension, method);
+
+ /* Skip empty strings / zero values from GSettings and
+ * defer to the default values defined by ESourceProxy. */
+
+ string = g_settings_get_string (settings, "autoconfig-url");
+ if (string != NULL && *string != '\0')
+ e_source_proxy_set_autoconfig_url (extension, string);
+ g_free (string);
+
+ strv = g_settings_get_strv (settings, "ignore-hosts");
+ if (strv != NULL && *strv != NULL)
+ e_source_proxy_set_ignore_hosts (
+ extension, (const gchar * const *) strv);
+ g_strfreev (strv);
+
+ string = g_settings_get_string (settings, "http-host");
+ if (string != NULL && *string != '\0')
+ e_source_proxy_set_http_host (extension, string);
+ g_free (string);
+
+ v_int = g_settings_get_int (settings, "http-port");
+ if (v_int > 0)
+ e_source_proxy_set_http_port (extension, (guint16) v_int);
+
+ v_bool = g_settings_get_boolean (settings, "use-authentication");
+ e_source_proxy_set_http_use_auth (extension, v_bool);
+
+ string = g_settings_get_string (settings, "authentication-user");
+ if (string != NULL && *string != '\0')
+ e_source_proxy_set_http_auth_user (extension, string);
+ g_free (string);
+
+ string = g_settings_get_string (settings, "authentication-password");
+ if (string != NULL && *string != '\0')
+ e_source_proxy_set_http_auth_password (extension, string);
+ g_free (string);
+
+ string = g_settings_get_string (settings, "secure-host");
+ if (string != NULL && *string != '\0')
+ e_source_proxy_set_https_host (extension, string);
+ g_free (string);
+
+ v_int = g_settings_get_int (settings, "secure-port");
+ if (v_int > 0)
+ e_source_proxy_set_https_port (extension, (guint16) v_int);
+
+ string = g_settings_get_string (settings, "socks-host");
+ if (string != NULL && *string != '\0')
+ e_source_proxy_set_socks_host (extension, string);
+ g_free (string);
+
+ v_int = g_settings_get_int (settings, "socks-port");
+ if (v_int > 0)
+ e_source_proxy_set_socks_port (extension, (guint16) v_int);
+
+ g_object_unref (settings);
+}
+
diff --git a/services/evolution-source-registry/evolution-source-registry.c b/services/evolution-source-registry/evolution-source-registry.c
index b0d040f44..6aeced4d6 100644
--- a/services/evolution-source-registry/evolution-source-registry.c
+++ b/services/evolution-source-registry/evolution-source-registry.c
@@ -40,6 +40,8 @@ gboolean evolution_source_registry_migrate_imap_to_imapx
(ESourceRegistryServer *server,
GKeyFile *key_file,
const gchar *uid);
+void evolution_source_registry_migrate_proxies
+ (ESourceRegistryServer *server);
static void
evolution_source_registry_load_error (ESourceRegistryServer *server,
@@ -100,6 +102,9 @@ evolution_source_registry_load_all (ESourceRegistryServer *server,
if (!success)
return FALSE;
+ /* Migrate proxy settings from Evolution. */
+ evolution_source_registry_migrate_proxies (server);
+
/* Signal that all files are now loaded. One thing this
* does is tell the cache-reaper module to start scanning
* for orphaned cache directories. */
diff --git a/services/evolution-source-registry/org.gnome.evolution.shell.network-config.gschema.xml.in b/services/evolution-source-registry/org.gnome.evolution.shell.network-config.gschema.xml.in
new file mode 100644
index 000000000..265158258
--- /dev/null
+++ b/services/evolution-source-registry/org.gnome.evolution.shell.network-config.gschema.xml.in
@@ -0,0 +1,75 @@
+<schemalist>
+ <schema gettext-domain="evolution-data-server" id="org.gnome.evolution.shell.network-config" path="/org/gnome/evolution/shell/network-config/">
+
+ <!-- This entire schema is deprecated. Network proxy settings are
+ integrated into the ESource framework and are written to disk
+ as plain text key files.
+ -->
+
+ <key name="proxy-type" type="i">
+ <default>0</default>
+ <_summary>(Deprecated) Proxy type to use</_summary>
+ <_description>This key was deprecated in version 3.12 and should no longer be used. Proxy settings are now integrated into Evolution-Data-Server's account system. See the ESourceProxy API documentation for details.</_description>
+ </key>
+ <key name="use-http-proxy" type="b">
+ <default>false</default>
+ <_summary>(Deprecated) Whether to use http-proxy</_summary>
+ <_description>This key was deprecated in version 3.12 and should no longer be used. Proxy settings are now integrated into Evolution-Data-Server's account system. See the ESourceProxy API documentation for details.</_description>
+ </key>
+ <key name="use-authentication" type="b">
+ <default>false</default>
+ <_summary>(Deprecated) Whether proxy server requires authentication</_summary>
+ <_description>This key was deprecated in version 3.12 and should no longer be used. Proxy settings are now integrated into Evolution-Data-Server's account system. See the ESourceProxy API documentation for details.</_description>
+ </key>
+ <key name="http-host" type="s">
+ <default>''</default>
+ <_summary>(Deprecated) Host name for HTTP requests</_summary>
+ <_description>This key was deprecated in version 3.12 and should no longer be used. Proxy settings are now integrated into Evolution-Data-Server's account system. See the ESourceProxy API documentation for details.</_description>
+ </key>
+ <key name="http-port" type="i">
+ <default>0</default>
+ <_summary>(Deprecated) Port number for HTTP requests</_summary>
+ <_description>This key was deprecated in version 3.12 and should no longer be used. Proxy settings are now integrated into Evolution-Data-Server's account system. See the ESourceProxy API documentation for details.</_description>
+ </key>
+ <key name="authentication-user" type="s">
+ <default>''</default>
+ <_summary>(Deprecated) Proxy authentication user name</_summary>
+ <_description>This key was deprecated in version 3.12 and should no longer be used. Proxy settings are now integrated into Evolution-Data-Server's account system. See the ESourceProxy API documentation for details.</_description>
+ </key>
+ <key name="authentication-password" type="s">
+ <default>''</default>
+ <_summary>(Deprecated) Proxy authentication password</_summary>
+ <_description>This key was deprecated in version 3.12 and should no longer be used. Proxy settings are now integrated into Evolution-Data-Server's account system. See the ESourceProxy API documentation for details.</_description>
+ </key>
+ <key name="ignore-hosts" type="as">
+ <default>[]</default>
+ <_summary>(Deprecated) List of hosts to connect to without proxy</_summary>
+ <_description>This key was deprecated in version 3.12 and should no longer be used. Proxy settings are now integrated into Evolution-Data-Server's account system. See the ESourceProxy API documentation for details.</_description>
+ </key>
+ <key name="secure-host" type="s">
+ <default>''</default>
+ <_summary>(Deprecated) Host name for HTTPS requests</_summary>
+ <_description>This key was deprecated in version 3.12 and should no longer be used. Proxy settings are now integrated into Evolution-Data-Server's account system. See the ESourceProxy API documentation for details.</_description>
+ </key>
+ <key name="secure-port" type="i">
+ <default>0</default>
+ <_summary>(Deprecated) Port number for HTTPS requests</_summary>
+ <_description>This key was deprecated in version 3.12 and should no longer be used. Proxy settings are now integrated into Evolution-Data-Server's account system. See the ESourceProxy API documentation for details.</_description>
+ </key>
+ <key name="socks-host" type="s">
+ <default>''</default>
+ <_summary>(Deprecated) Host name for SOCKS requests</_summary>
+ <_description>This key was deprecated in version 3.12 and should no longer be used. Proxy settings are now integrated into Evolution-Data-Server's account system. See the ESourceProxy API documentation for details.</_description>
+ </key>
+ <key name="socks-port" type="i">
+ <default>0</default>
+ <_summary>(Deprecated) Port number for SOCKS requests</_summary>
+ <_description>This key was deprecated in version 3.12 and should no longer be used. Proxy settings are now integrated into Evolution-Data-Server's account system. See the ESourceProxy API documentation for details.</_description>
+ </key>
+ <key name="autoconfig-url" type="s">
+ <default>''</default>
+ <_summary>(Deprecated) Automatic proxy configuration URL</_summary>
+ <_description>This key was deprecated in version 3.12 and should no longer be used. Proxy settings are now integrated into Evolution-Data-Server's account system. See the ESourceProxy API documentation for details.</_description>
+ </key>
+ </schema>
+</schemalist>