[evolution] Bug 623201 - Set default options automatically while creating a new account



commit ea49fac12e759170cdabd0673b3c0e1861ee7d3f
Author: Chenthill Palanisamy <pchenthill novell com>
Date:   Wed Jun 30 16:22:26 2010 +0530

    Bug 623201 - Set default options automatically while creating a new account

 mail/em-account-editor.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index 02cadc9..603aa52 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -143,6 +143,7 @@ struct _EMAccountEditorPrivate {
 
 	EAccount *modified_account;
 	EAccount *original_account;
+	gboolean new_account;
 
 	struct _EMConfig *config;
 	GList *providers;
@@ -248,6 +249,7 @@ emae_set_original_account (EMAccountEditor *emae,
 	} else {
 		modified_account = e_account_new ();
 		modified_account->enabled = TRUE;
+		emae->priv->new_account = TRUE;
 
 		e_account_set_string (
 			modified_account, E_ACCOUNT_DRAFTS_FOLDER_URI,
@@ -2284,7 +2286,9 @@ emae_option_toggle (EMAccountEditorService *service, CamelURL *url, const gchar
 {
 	GtkWidget *w;
 
-	/* FIXME: how do we get the default value ever? */
+	if (service->emae->priv->new_account && def)
+		camel_url_set_param (url, name, "");
+
 	w = gtk_check_button_new_with_mnemonic (text);
 	g_object_set_data ((GObject *)w, "option-name", (gpointer)name);
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), camel_url_get_param (url, name) != NULL);
@@ -2389,6 +2393,13 @@ emae_option_checkspin (EMAccountEditorService *service, CamelURL *url, const gch
 		max = 1.0;
 	}
 
+	if (service->emae->priv->new_account && on == 'y') {
+		gchar value[16];
+
+		sprintf (value, "%d", (gint) def);
+		camel_url_set_param (url, name, value);
+	}
+
 	if ((enable = (val = camel_url_get_param (url, name)) != NULL) )
 		def = strtod (val, NULL);
 	else



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