aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-09-06 07:04:33 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-09-06 07:04:33 +0800
commitde4c391ec2eba36667a8ed7622f57f1877dda934 (patch)
tree9b4a8f2302c558089d70722f4be2e2164962a613
parent56ed3ed3b9fd94ed34c92aa6bbcd26bb56208595 (diff)
downloadgsoc2013-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
-rw-r--r--mail/ChangeLog15
-rw-r--r--mail/component-factory.c5
-rw-r--r--mail/mail-config.c18
3 files changed, 31 insertions, 7 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 2db02bc893..568b6dcc74 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,17 @@
+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.
+
2001-09-05 Ettore Perazzoli <ettore@ximian.com>
[Fix #958, ShellComponents should not be created by factories, for
@@ -53,6 +67,7 @@
2001-09-05 Ettore Perazzoli <ettore@ximian.com>
+>>>>>>> 1.1649
* message-browser.c (message_browser_new): s/Evolution/Ximian
Evolution/.
diff --git a/mail/component-factory.c b/mail/component-factory.c
index a66200f5b5..8dbf22fe1b 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -633,8 +633,7 @@ owner_set_cb (EvolutionShellComponent *shell_component,
evolution_dir = g_strdup (evolution_homedir);
mail_session_init ();
- mail_config_init ();
-
+
storages_hash = g_hash_table_new (NULL, NULL);
vfolder_create_storage (shell_component);
@@ -648,7 +647,7 @@ owner_set_cb (EvolutionShellComponent *shell_component,
news = mail_config_get_news ();
mail_load_storages (corba_shell, news, FALSE);
#endif
-
+
mail_local_storage_startup (shell_client, evolution_dir);
mail_importer_init (shell_client);
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;
}