[evolution-ews/gnome-3-2] Prefill Host URL when creating new account (cherry picked from commit 5fb55ca5378d25fd39bdcc078b70d1



commit 9283b0877938bed6a5d88f23405a2ab3a838cba0
Author: Milan Crha <mcrha redhat com>
Date:   Thu Oct 20 14:46:28 2011 +0200

    Prefill Host URL when creating new account
    (cherry picked from commit 5fb55ca5378d25fd39bdcc078b70d1a1bbbee069)

 .../exchange-ews-account-setup.c                   |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/account-setup-eplugin/exchange-ews-account-setup.c b/src/account-setup-eplugin/exchange-ews-account-setup.c
index e542e39..7a981e6 100644
--- a/src/account-setup-eplugin/exchange-ews-account-setup.c
+++ b/src/account-setup-eplugin/exchange-ews-account-setup.c
@@ -233,6 +233,7 @@ org_gnome_exchange_ews_account_setup (EPlugin *epl, EConfigHookItemFactoryData *
 		const gchar *host_url_val = camel_url_get_param (url, "hosturl");
 		const gchar *oab_url_val = camel_url_get_param (url, "oaburl");
 		const gchar *temp, *email_id;
+		gchar *temp_host_url_val = NULL;
 		gchar *url_string;
 		struct _AutoDiscCallBackData *cbdata = g_new0 (struct _AutoDiscCallBackData, 1);
 		EAccount *account;
@@ -246,8 +247,15 @@ org_gnome_exchange_ews_account_setup (EPlugin *epl, EConfigHookItemFactoryData *
 		camel_url_set_param (url, "email", email_id);
 		temp = g_strstr_len (email_id, -1, "@");
 		/* Don't overwrite the URL if it's already been set */
-		if (!url->host || !url->host[0])
-			camel_url_set_host (url, g_strdup (temp + 1));
+		if (temp && (!url->host || !url->host[0])) {
+			camel_url_set_host (url, temp + 1);
+		}
+
+		if (temp && (!host_url_val || !*host_url_val)) {
+			temp_host_url_val = g_strdup_printf ("https://exchange.%s/EWS/Exchange.asmx";, temp + 1);
+			host_url_val = temp_host_url_val;
+			camel_url_set_param (url, "hosturl", host_url_val);
+		}
 
 		url_string = camel_url_to_string (url, 0);
 		e_account_set_string (account, E_ACCOUNT_SOURCE_URL, url_string);
@@ -274,6 +282,8 @@ org_gnome_exchange_ews_account_setup (EPlugin *epl, EConfigHookItemFactoryData *
 		gtk_label_set_mnemonic_widget (GTK_LABEL (label), host_url);
 		if (host_url_val && *host_url_val)
 			gtk_entry_set_text (GTK_ENTRY (host_url), host_url_val);
+		else
+			gtk_entry_set_text (GTK_ENTRY (host_url), "https://exchange.server.com/EWS/Exchange.asmx";);
 		gtk_box_pack_start (GTK_BOX (hbox), host_url, TRUE, TRUE, 0);
 		g_signal_connect (host_url, "changed", G_CALLBACK(host_url_changed), data->config);
 
@@ -294,6 +304,8 @@ org_gnome_exchange_ews_account_setup (EPlugin *epl, EConfigHookItemFactoryData *
 		gtk_table_attach (GTK_TABLE (data->parent), oab_label, 0, 1, row, row+1, 0, 0, 0, 0);
 		gtk_table_attach (GTK_TABLE (data->parent), oab_url, 1, 2, row, row+1, GTK_FILL|GTK_EXPAND, GTK_FILL, 0, 0);
 		row++;
+
+		g_free (temp_host_url_val);
 	}
 
 	camel_url_free (url);



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