diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-09-06 07:04:33 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-09-06 07:04:33 +0800 |
commit | de4c391ec2eba36667a8ed7622f57f1877dda934 (patch) | |
tree | 9b4a8f2302c558089d70722f4be2e2164962a613 /mail/mail-config.c | |
parent | 56ed3ed3b9fd94ed34c92aa6bbcd26bb56208595 (diff) | |
download | gsoc2013-evolution-de4c391ec2eba36667a8ed7622f57f1877dda934.tar.gz gsoc2013-evolution-de4c391ec2eba36667a8ed7622f57f1877dda934.tar.zst gsoc2013-evolution-de4c391ec2eba36667a8ed7622f57f1877dda934.zip |
Adjust the default_account index correctly.
2001-09-05 Jeffrey Stedfast <fejj@ximian.com>
* mail-config.c (mail_config_remove_account): Adjust the
default_account index correctly.
2001-09-05 Jeffrey Stedfast <fejj@ximian.com>
* mail-config.c (mail_config_get_accounts): Added a g_assert to
make sure that config wasn't NULL. This is meant to help debug bug
#4911 and friends.
* component-factory.c (owner_set_cb): Do not mail_config_init()
here as we've already called this in main() in main.c.
svn path=/trunk/; revision=12640
Diffstat (limited to 'mail/mail-config.c')
-rw-r--r-- | mail/mail-config.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/mail/mail-config.c b/mail/mail-config.c index 1ae74ae0e8..68b310daa0 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -461,7 +461,7 @@ config_read (void) default_num = bonobo_config_get_long_with_default (config->db, "/Mail/Accounts/default_account", 0, NULL); - + mail_config_set_default_account_num (default_num); #ifdef ENABLE_NNTP @@ -1438,6 +1438,8 @@ mail_config_get_account_by_transport_url (const char *transport_url) const GSList * mail_config_get_accounts (void) { + g_assert (config != NULL); + return config->accounts; } @@ -1658,15 +1660,23 @@ remove_account_shortcuts (MailConfigAccount *account) const GSList * mail_config_remove_account (MailConfigAccount *account) { + int index; + /* Removing the current default, so make the first account the default */ - if (account == mail_config_get_default_account ()) + if (account == mail_config_get_default_account ()) { config->default_account = 0; - + } else { + /* adjust the default to make sure it points to the same one */ + index = g_slist_index (config->accounts, account); + if (config->default_account > index) + config->default_account--; + } + config->accounts = g_slist_remove (config->accounts, account); remove_account_shortcuts (account); account_destroy (account); - + return config->accounts; } |