aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-09-21 10:21:12 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-09-21 10:21:12 +0800
commitf21fc37e3c2025f2a6b4ed3a24123d2a7fd5eed4 (patch)
tree3ff576d259a84975fb59178039a0625ac67c73d5 /mail
parenta7006d79617c55e3cd774ad7589d8d71585dae7d (diff)
downloadgsoc2013-evolution-f21fc37e3c2025f2a6b4ed3a24123d2a7fd5eed4.tar.gz
gsoc2013-evolution-f21fc37e3c2025f2a6b4ed3a24123d2a7fd5eed4.tar.zst
gsoc2013-evolution-f21fc37e3c2025f2a6b4ed3a24123d2a7fd5eed4.zip
Only add the account if it doesn't already exist in the config db.
2001-09-20 Jeffrey Stedfast <fejj@ximian.com> * mail-account-gui.c (mail_account_gui_save): Only add the account if it doesn't already exist in the config db. * mail-config.c (mail_config_find_account): New convenience function. svn path=/trunk/; revision=13039
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog6
-rw-r--r--mail/mail-account-gui.c7
-rw-r--r--mail/mail-config.c6
-rw-r--r--mail/mail-config.h1
4 files changed, 17 insertions, 3 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 9c4e32a437..5feabe3c2a 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,11 @@
2001-09-20 Jeffrey Stedfast <fejj@ximian.com>
+ * mail-account-gui.c (mail_account_gui_save): Only add the account
+ if it doesn't already exist in the config db.
+
+ * mail-config.c (mail_config_find_account): New convenience
+ function.
+
* mail-config-druid.c (wizard_finish_cb): Do not add the account
here as this is taken care of in mail_account_gui_save() since it
has to be able to set the default account.
diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c
index 9189283afb..c8281be799 100644
--- a/mail/mail-account-gui.c
+++ b/mail/mail-account-gui.c
@@ -1195,8 +1195,8 @@ mail_account_gui_new (MailConfigAccount *account)
gui->default_account = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "management_default"));
if (account->name)
e_utf8_gtk_entry_set_text (gui->account_name, account->name);
- if (!mail_config_get_default_account()
- || (account == mail_config_get_default_account()))
+ if (!mail_config_get_default_account ()
+ || (account == mail_config_get_default_account ()))
gtk_toggle_button_set_active (gui->default_account, TRUE);
/* Identity */
@@ -1657,7 +1657,8 @@ mail_account_gui_save (MailAccountGui *gui)
account->smime_encrypt_to_self = gtk_toggle_button_get_active (gui->smime_encrypt_to_self);
account->smime_always_sign = gtk_toggle_button_get_active (gui->smime_always_sign);
- mail_config_add_account (account);
+ if (!mail_config_find_account (account))
+ mail_config_add_account (account);
if (gtk_toggle_button_get_active (gui->default_account))
mail_config_set_default_account (account);
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 709bde47c3..a518144a47 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -1369,6 +1369,12 @@ mail_config_set_default_charset (const char *charset)
}
+gboolean
+mail_config_find_account (const MailConfigAccount *account)
+{
+ return g_slist_find (config->accounts, (gpointer) account) != NULL;
+}
+
const MailConfigAccount *
mail_config_get_default_account (void)
{
diff --git a/mail/mail-config.h b/mail/mail-config.h
index d223ba1eda..10bce30d07 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -177,6 +177,7 @@ void mail_config_set_default_charset (const char *charset);
void mail_config_service_set_save_passwd (MailConfigService *service, gboolean save_passwd);
+gboolean mail_config_find_account (const MailConfigAccount *account);
const MailConfigAccount *mail_config_get_default_account (void);
gint mail_config_get_default_account_num (void);
const MailConfigAccount *mail_config_get_account_by_name (const char *account_name);