[evolution] Bug #686785 - Port of WebDAV source doesn't match SSL check



commit 529b5bf4a0f80eeebebe2fdb67a7fab4a146cb25
Author: Milan Crha <mcrha redhat com>
Date:   Wed Oct 24 21:01:18 2012 +0200

    Bug #686785 - Port of WebDAV source doesn't match SSL check

 widgets/misc/e-source-config.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/widgets/misc/e-source-config.c b/widgets/misc/e-source-config.c
index f8b6252..9b4ad13 100644
--- a/widgets/misc/e-source-config.c
+++ b/widgets/misc/e-source-config.c
@@ -1333,6 +1333,26 @@ e_source_config_add_secure_connection (ESourceConfig *config,
 		G_BINDING_SYNC_CREATE);
 }
 
+static gboolean
+secure_to_port_cb (GBinding *binding,
+		   const GValue *source_value,
+		   GValue *target_value,
+		   gpointer user_data)
+{
+	GObject *authentication_extension;
+	guint16 port;
+
+	authentication_extension = g_binding_get_target (binding);
+	g_object_get (authentication_extension, "port", &port, NULL);
+
+	if (port == 80 || port == 443 || port == 0)
+		port = g_value_get_boolean (source_value) ? 443 : 80;
+
+	g_value_set_uint (target_value, port);
+
+	return TRUE;
+}
+
 void
 e_source_config_add_secure_connection_for_webdav (ESourceConfig *config,
                                                   ESource *scratch_source)
@@ -1340,6 +1360,7 @@ e_source_config_add_secure_connection_for_webdav (ESourceConfig *config,
 	GtkWidget *widget1;
 	GtkWidget *widget2;
 	ESourceExtension *extension;
+	ESourceAuthentication *authentication_extension;
 	const gchar *extension_name;
 	const gchar *label;
 
@@ -1360,6 +1381,16 @@ e_source_config_add_secure_connection_for_webdav (ESourceConfig *config,
 		G_BINDING_BIDIRECTIONAL |
 		G_BINDING_SYNC_CREATE);
 
+	extension_name = E_SOURCE_EXTENSION_AUTHENTICATION;
+	authentication_extension = e_source_get_extension (scratch_source, extension_name);
+
+	g_object_bind_property_full (
+		extension, "secure",
+		authentication_extension, "port",
+		G_BINDING_DEFAULT,
+		secure_to_port_cb,
+		NULL, NULL, NULL);
+
 	extension_name = E_SOURCE_EXTENSION_WEBDAV_BACKEND;
 	extension = e_source_get_extension (scratch_source, extension_name);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]