diff options
author | Milan Crha <mcrha@redhat.com> | 2012-01-11 01:18:44 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2012-01-11 01:18:44 +0800 |
commit | fea81db90a01ce184e5955c19d4c340aeb1cbfff (patch) | |
tree | a97ea2961c973d38a9a434124eb19dafc293929f /mail | |
parent | a4afc774381b8da813b8a615a4e5f29fabbcee7c (diff) | |
download | gsoc2013-evolution-fea81db90a01ce184e5955c19d4c340aeb1cbfff.tar.gz gsoc2013-evolution-fea81db90a01ce184e5955c19d4c340aeb1cbfff.tar.zst gsoc2013-evolution-fea81db90a01ce184e5955c19d4c340aeb1cbfff.zip |
EMailSession does not respect user settings on start
Running in offline had no meaning, a store connected to its
server anyway.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-session.c | 75 |
1 files changed, 47 insertions, 28 deletions
diff --git a/mail/e-mail-session.c b/mail/e-mail-session.c index 1fe82eb78c..57c800cb91 100644 --- a/mail/e-mail-session.c +++ b/mail/e-mail-session.c @@ -1069,6 +1069,46 @@ mail_session_notify (GObject *object, g_object_notify (object, "junk-filter-name"); } +static gboolean +mail_session_initialize_stores_idle (gpointer user_data) +{ + EMailSession *session = user_data; + EAccountList *account_list; + EAccount *account; + EIterator *iter; + + g_return_val_if_fail (session != NULL, FALSE); + + /* Load user-defined mail accounts. */ + account_list = session->priv->account_list; + iter = e_list_get_iterator (E_LIST (account_list)); + + while (e_iterator_is_valid (iter)) { + /* XXX EIterator misuses const. */ + account = (EAccount *) e_iterator_get (iter); + + mail_session_add_by_account (session, account); + + e_iterator_next (iter); + } + + g_object_unref (iter); + + /* Initialize which account is default. */ + + account = e_get_default_account (); + if (account != NULL) { + CamelService *service; + + service = camel_session_get_service ( + CAMEL_SESSION (session), account->uid); + e_mail_account_store_set_default_service ( + session->priv->account_store, service); + } + + return FALSE; +} + static void mail_session_constructed (GObject *object) { @@ -1079,8 +1119,6 @@ mail_session_constructed (GObject *object) GList *list, *link; GSettings *settings; EAccountList *account_list; - EIterator *iter; - EAccount *account; gulong handler_id; session = E_MAIL_SESSION (object); @@ -1113,32 +1151,13 @@ mail_session_constructed (GObject *object) mail_session_add_local_store (session); mail_session_add_vfolder_store (session); - /* Load user-defined mail accounts. */ - - iter = e_list_get_iterator (E_LIST (account_list)); - - while (e_iterator_is_valid (iter)) { - /* XXX EIterator misuses const. */ - account = (EAccount *) e_iterator_get (iter); - - mail_session_add_by_account (session, account); - - e_iterator_next (iter); - } - - g_object_unref (iter); - - /* Initialize which account is default. */ - - account = e_get_default_account (); - if (account != NULL) { - CamelService *service; - - service = camel_session_get_service ( - CAMEL_SESSION (session), account->uid); - e_mail_account_store_set_default_service ( - session->priv->account_store, service); - } + /* Give it a chance to load user settings, they are not loaded yet. + * + * XXX Is this the case where hiding such natural things like loading + * user setting into an EExtension strikes back and proves itself + * being suboptimal? + */ + g_idle_add (mail_session_initialize_stores_idle, object); /* Listen for account list updates. */ |