aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/e-mail-backend.c21
-rw-r--r--mail/e-mail-migrate.c11
-rw-r--r--mail/e-mail-store.c4
-rw-r--r--modules/mail/e-mail-shell-backend.c6
4 files changed, 17 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;
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index 590241a838..c7bba4944a 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -514,7 +514,9 @@ mail_shell_backend_start (EShellBackend *shell_backend)
EShell *shell;
EShellSettings *shell_settings;
EMailBackend *backend;
+ EMailSession *session;
gboolean enable_search_folders;
+ const gchar *data_dir;
priv = E_MAIL_SHELL_BACKEND_GET_PRIVATE (shell_backend);
@@ -522,6 +524,10 @@ mail_shell_backend_start (EShellBackend *shell_backend)
shell_settings = e_shell_get_shell_settings (shell);
backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+
+ e_mail_store_init (session, data_dir);
enable_search_folders = e_shell_settings_get_boolean (
shell_settings, "mail-enable-search-folders");