diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-01-08 03:52:07 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-06-30 00:41:16 +0800 |
commit | c5265294a3999b134e6f4d7d93b03001312cd075 (patch) | |
tree | cd230a50fe70324407d7e437e0b6918aa7968e70 /mail | |
parent | 10a835d5e6e7a259d3ba68c43a13c28d619f8780 (diff) | |
download | gsoc2013-evolution-c5265294a3999b134e6f4d7d93b03001312cd075.tar.gz gsoc2013-evolution-c5265294a3999b134e6f4d7d93b03001312cd075.tar.zst gsoc2013-evolution-c5265294a3999b134e6f4d7d93b03001312cd075.zip |
Avoid idle callbacks in EMailBackend initialization.
If the migration phase has to show a dialog the idle callback for
intializing mail stores will run too soon. Instead, hook it onto
the EShellBackend start() method.
Migration code can initialize mail stores early if it needs to.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-backend.c | 21 | ||||
-rw-r--r-- | mail/e-mail-migrate.c | 11 | ||||
-rw-r--r-- | mail/e-mail-store.c | 4 |
3 files changed, 11 insertions, 25 deletions
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c index 93262ec34c..740cf8526e 100644 --- a/mail/e-mail-backend.c +++ b/mail/e-mail-backend.c @@ -394,23 +394,6 @@ mail_backend_folder_changed_cb (MailFolderCache *folder_cache, (EEventTarget *) target); } -static gboolean -mail_backend_idle_cb (EMailBackend *backend) -{ - EMailSession *session; - EShellBackend *shell_backend; - const gchar *data_dir; - - session = e_mail_backend_get_session (backend); - - shell_backend = E_SHELL_BACKEND (backend); - data_dir = e_shell_backend_get_data_dir (shell_backend); - - e_mail_store_init (session, data_dir); - - return FALSE; -} - static void mail_backend_get_property (GObject *object, guint property_id, @@ -517,10 +500,6 @@ mail_backend_constructed (GObject *object) mail_config_init (priv->session); mail_msg_init (); - /* Defer initializing CamelStores until after the main loop - * has started, so migration has a chance to run first. */ - g_idle_add ((GSourceFunc) mail_backend_idle_cb, shell_backend); - if (G_OBJECT_CLASS (e_mail_backend_parent_class)->constructed) G_OBJECT_CLASS (e_mail_backend_parent_class)->constructed (object); } diff --git a/mail/e-mail-migrate.c b/mail/e-mail-migrate.c index 91a5e6fc43..ef12be0915 100644 --- a/mail/e-mail-migrate.c +++ b/mail/e-mail-migrate.c @@ -646,11 +646,14 @@ migrate_to_db (EShellBackend *shell_backend) mail_backend = E_MAIL_BACKEND (shell_backend); mail_session = e_mail_backend_get_session (mail_backend); + data_dir = e_shell_backend_get_data_dir (shell_backend); + + /* Initialize the mail stores early so we can add a new one. */ + e_mail_store_init (mail_session, data_dir); iter = e_list_get_iterator ((EList *) accounts); len = e_list_length ((EList *) accounts); - data_dir = e_shell_backend_get_data_dir (shell_backend); session = (EMMigrateSession *) em_migrate_session_new (data_dir); camel_session_set_online ((CamelSession *) session, FALSE); em_migrate_setup_progress_dialog ( @@ -965,10 +968,14 @@ create_mbox_account (EShellBackend *shell_backend, EMMigrateSession *session) mail_backend = E_MAIL_BACKEND (shell_backend); mail_session = e_mail_backend_get_session (mail_backend); + data_dir = e_shell_backend_get_data_dir (shell_backend); + + /* Initialize the mail stores early so we can add a new one. */ + e_mail_store_init (mail_session, data_dir); + account = e_account_new (); account->enabled = TRUE; - data_dir = e_shell_backend_get_data_dir (shell_backend); url = camel_url_new ("mbox:", NULL); temp = g_build_filename (data_dir, "local_mbox", NULL); camel_url_set_path (url, temp); diff --git a/mail/e-mail-store.c b/mail/e-mail-store.c index ac0e97562b..1e4155bf6e 100644 --- a/mail/e-mail-store.c +++ b/mail/e-mail-store.c @@ -268,8 +268,8 @@ e_mail_store_init (EMailSession *session, g_return_if_fail (E_IS_MAIL_SESSION (session)); - /* This function is idempotent, but there should - * be no need to call it more than once. */ + /* This function is idempotent because mail + * migration code may need to call it early. */ if (initialized) return; |