aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2003-04-05 07:22:04 +0800
committerDan Winship <danw@src.gnome.org>2003-04-05 07:22:04 +0800
commit51ee0c1f2d8d7d16592b15868f088021a2f1b366 (patch)
tree1ab681f663834d239d8656dd2595abbe112528f4
parent48ec4a48f0414a14272a212dd54ff4fab67e9125 (diff)
downloadgsoc2013-evolution-51ee0c1f2d8d7d16592b15868f088021a2f1b366.tar.gz
gsoc2013-evolution-51ee0c1f2d8d7d16592b15868f088021a2f1b366.tar.zst
gsoc2013-evolution-51ee0c1f2d8d7d16592b15868f088021a2f1b366.zip
Don't start emitting ACCOUNT_ADDED signals until we've added all of the
* e-account-list.c (gconf_accounts_changed): Don't start emitting ACCOUNT_ADDED signals until we've added all of the new accounts to our list. Otherwise if the signal handler calls e_account_list_get_default_account() it will end up causing the first account in the list to become the default. #40675 svn path=/trunk/; revision=20680
-rw-r--r--e-util/ChangeLog8
-rw-r--r--e-util/e-account-list.c18
2 files changed, 23 insertions, 3 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index 8d78374234..dc8b1f130e 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,11 @@
+2003-04-04 Dan Winship <danw@ximian.com>
+
+ * e-account-list.c (gconf_accounts_changed): Don't start emitting
+ ACCOUNT_ADDED signals until we've added all of the new accounts to
+ our list. Otherwise if the signal handler calls
+ e_account_list_get_default_account() it will end up causing the
+ first account in the list to become the default. #40675
+
2003-04-04 Chris Toshok <toshok@ximian.com>
* ename/e-name-western.c (e_name_western_extract_middle): fix abr.
diff --git a/e-util/e-account-list.c b/e-util/e-account-list.c
index 825601f2af..acb9093cb4 100644
--- a/e-util/e-account-list.c
+++ b/e-util/e-account-list.c
@@ -130,7 +130,7 @@ gconf_accounts_changed (GConfClient *client, guint cnxn_id,
GConfEntry *entry, gpointer user_data)
{
EAccountList *account_list = user_data;
- GSList *list, *l;
+ GSList *list, *l, *new_accounts = NULL;
EAccount *account;
EList *old_accounts;
EIterator *iter;
@@ -164,14 +164,26 @@ gconf_accounts_changed (GConfClient *client, guint cnxn_id,
/* Must be a new account */
account = e_account_new_from_xml (l->data);
e_list_append (E_LIST (account_list), account);
- g_signal_emit (account_list, signals[ACCOUNT_ADDED], 0, account);
- g_object_unref (account);
+ new_accounts = g_slist_prepend (new_accounts, account);
next:
g_free (uid);
g_object_unref (iter);
}
+ /* Now emit signals for each added account. (We do this after
+ * adding all of them because otherwise if the signal handler
+ * calls e_account_list_get_default_account() it will end up
+ * causing the first account in the list to become the
+ * default.)
+ */
+ for (l = new_accounts; l; l = l->next) {
+ account = l->data;
+ g_signal_emit (account_list, signals[ACCOUNT_ADDED], 0, account);
+ g_object_unref (account);
+ }
+ g_slist_free (new_accounts);
+
/* Anything left in old_accounts must have been deleted */
for (iter = e_list_get_iterator (old_accounts);
e_iterator_is_valid (iter);