Hi,
  Currently it is not possible to configure a exchange account in
evolution if the mailbox name and account name are different which is a
major issue. This patch adds a new Entry to the account configuration
window to allow the user to specify the mailbox name if its different.
The author of the patch is Milan ([EMAIL PROTECTED]). The patch does not
break any API/ABI. This has been reviewed and tested well enough. More
details can be found in the bug.

The patch can be found at
http://bugzilla.gnome.org/show_bug.cgi?id=273627#c88 .


Have attached the screen shot.


thanks, Chenthill.
Index: plugins/exchange-operations/exchange-account-setup.c
===================================================================
--- plugins/exchange-operations/exchange-account-setup.c	(revision 35582)
+++ plugins/exchange-operations/exchange-account-setup.c	(working copy)
@@ -426,6 +426,7 @@ owa_authenticate_user(GtkWidget *button,
 	char *at, *user;
 	gboolean valid = FALSE;
 	ExchangeParams *exchange_params;
+	GtkWidget *mailbox_entry = g_object_get_data (G_OBJECT (button), "mailbox-entry");
 
 	exchange_params = g_new0 (ExchangeParams, 1);
 	exchange_params->host = NULL;
@@ -467,6 +468,9 @@ owa_authenticate_user(GtkWidget *button,
 	/* Supress the trailing slash */
 	key [strlen(key) -1] = 0;
 
+	/* set the mailbox before function call to let it use our, not create one */
+	exchange_params->mailbox = g_strdup (camel_url_get_param (url, "mailbox"));
+
 	valid =  e2k_validate_user (owa_url, key, &url->user, exchange_params,
 						&remember_password, &result,
 						GTK_WINDOW (gtk_widget_get_toplevel (button)));
@@ -485,6 +489,12 @@ owa_authenticate_user(GtkWidget *button,
 	camel_url_set_param (url, "mailbox", valid ? exchange_params->mailbox : NULL);
 	camel_url_set_param (url, "owa_path", valid ? exchange_params->owa_path : NULL);
 
+	if (mailbox_entry) {
+		const char *par = camel_url_get_param (url, "mailbox");
+
+		gtk_entry_set_text (GTK_ENTRY (mailbox_entry), par ? par : "");
+	}
+
 	g_free (exchange_params->owa_path);
 	g_free (exchange_params->mailbox);
 	g_free (exchange_params->host);
@@ -542,6 +552,46 @@ owa_editor_entry_changed(GtkWidget *entr
 	camel_url_free (url);
 }
 
+static void
+update_mailbox_param_in_url (EAccount *account, e_account_item_t item, const char *mailbox)
+{
+	CamelURL *url;
+	char *url_string;
+	const char *target_url;
+
+	if (!account)
+		return;
+
+	target_url = e_account_get_string (account, item);
+	if (target_url && target_url[0] != '\0')
+		url = camel_url_new (target_url, NULL);
+	else
+		return;
+
+	if (mailbox && *mailbox)
+		camel_url_set_param (url, "mailbox", mailbox);
+	else
+		camel_url_set_param (url, "mailbox", NULL);
+
+	url_string = camel_url_to_string (url, 0);
+	e_account_set_string (account, item, url_string);
+	g_free (url_string);
+	camel_url_free (url);
+}
+
+static void
+mailbox_editor_entry_changed (GtkWidget *entry, EConfig *config)
+{
+	EMConfigTargetAccount *target;
+	const char *mailbox;
+
+	target = (EMConfigTargetAccount *)config->target;
+	mailbox = gtk_entry_get_text (GTK_ENTRY (entry));
+
+	update_mailbox_param_in_url (target->account, E_ACCOUNT_SOURCE_URL, mailbox);
+	update_mailbox_param_in_url (target->account, E_ACCOUNT_TRANSPORT_URL, mailbox);
+}
+
 static char *
 construct_owa_url (CamelURL *url)
 {
@@ -574,8 +624,8 @@ org_gnome_exchange_owa_url(EPlugin *epl,
 {
 	EMConfigTargetAccount *target_account;
 	const char *source_url;
-	char *owa_url = NULL;
-	GtkWidget *owa_entry;
+	char *owa_url = NULL, *mailbox_name;
+	GtkWidget *owa_entry, *mailbox_entry;
 	CamelURL *url;
 	int row;
 	GtkWidget *hbox, *label, *button;
@@ -607,6 +657,7 @@ org_gnome_exchange_owa_url(EPlugin *epl,
 	}
 
 	owa_url = g_strdup (camel_url_get_param(url, "owa_url"));
+	mailbox_name = g_strdup (camel_url_get_param (url, "mailbox"));
 
 	/* if the host is null, then user+other info is dropped silently, force it to be kept */
 	if (url->host == NULL) {
@@ -667,7 +718,26 @@ org_gnome_exchange_owa_url(EPlugin *epl,
 	/* check for correctness of the input in the owa_entry */
 	owa_editor_entry_changed (owa_entry, data->config);
 
+	row++;
+	label = gtk_label_new_with_mnemonic (_("_Mailbox:"));
+	gtk_widget_show (label);
+
+	mailbox_entry = gtk_entry_new ();
+	gtk_widget_show (mailbox_entry);
+	if (mailbox_name)
+		gtk_entry_set_text (GTK_ENTRY (mailbox_entry), mailbox_name);
+
+	gtk_label_set_mnemonic_widget (GTK_LABEL (label), mailbox_entry);
+
+	g_signal_connect (mailbox_entry, "changed", G_CALLBACK (mailbox_editor_entry_changed), data->config);
+	g_object_set_data (G_OBJECT (button), "mailbox-entry", mailbox_entry);
+
+	gtk_table_attach (GTK_TABLE (data->parent), label, 0, 1, row, row+1, 0, 0, 0, 0);
+	gtk_table_attach (GTK_TABLE (data->parent), mailbox_entry, 1, 2, row, row+1, GTK_FILL|GTK_EXPAND, GTK_FILL, 0, 0);
+
 	g_free (owa_url);
+	g_free (mailbox_name);
+
 	return hbox;
 }
 
Index: plugins/exchange-operations/ChangeLog
===================================================================
--- plugins/exchange-operations/ChangeLog	(revision 35582)
+++ plugins/exchange-operations/ChangeLog	(working copy)
@@ -1,3 +1,13 @@
+2008-06-03  Milan Crha  <[EMAIL PROTECTED]>
+
+	** Fix for bug #273627
+
+	* exchange-account-setup.c: (owa_authenticate_user),
+	(update_mailbox_param_in_url), (mailbox_editor_entry_changed),
+	(org_gnome_exchange_owa_url): New entry to enter mailbox name in case
+	it differs from the username. The entry is updated after a validation
+	and shows the mailbox name as was used for validation.
+
 2008-06-02  Jacob Brown  <[EMAIL PROTECTED]>
 
 	** Fix for bug #529464

<<attachment: Screenshot-Evolution Account Assistant.jpg>>

_______________________________________________
gnome-i18n mailing list
gnome-i18n@gnome.org
http://mail.gnome.org/mailman/listinfo/gnome-i18n

Reply via email to