diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-07-23 05:07:52 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-07-27 20:58:50 +0800 |
commit | 6affbe33e90b4157380eff3dad6a9654c9a24443 (patch) | |
tree | b82de645ced44be6c6aa28a0b0759ba17afb1624 /mail | |
parent | eba9b45f9e0e2a7f1a8d2d79f14d9e5f3aded19e (diff) | |
download | gsoc2013-evolution-6affbe33e90b4157380eff3dad6a9654c9a24443.tar.gz gsoc2013-evolution-6affbe33e90b4157380eff3dad6a9654c9a24443.tar.zst gsoc2013-evolution-6affbe33e90b4157380eff3dad6a9654c9a24443.zip |
Migrate ~/.evolution to XDG base directories.
Migration runs just before the main loop starts.
It's just a sequence of local directory and file renames.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-backend.c | 16 | ||||
-rw-r--r-- | mail/em-utils.c | 2 | ||||
-rw-r--r-- | mail/mail-config.c | 2 | ||||
-rw-r--r-- | mail/mail-session.c | 10 |
4 files changed, 18 insertions, 12 deletions
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c index b2e22e397d..14a7d22ad3 100644 --- a/mail/e-mail-backend.c +++ b/mail/e-mail-backend.c @@ -368,6 +368,17 @@ mail_backend_folder_changed_cb (MailFolderCache *folder_cache, (EEventTarget *) target); } +static gboolean +mail_backend_idle_cb (EShellBackend *shell_backend) +{ + const gchar *data_dir; + + data_dir = e_shell_backend_get_data_dir (shell_backend); + e_mail_store_init (data_dir); + + return FALSE; +} + static void mail_backend_constructed (GObject *object) { @@ -422,8 +433,9 @@ mail_backend_constructed (GObject *object) mail_config_init (); mail_msg_init (); - data_dir = e_shell_backend_get_data_dir (shell_backend); - e_mail_store_init (data_dir); + /* 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); } static void diff --git a/mail/em-utils.c b/mail/em-utils.c index e182e61364..80699ec7a2 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -2342,7 +2342,7 @@ emu_restore_folder_tree_state (EMFolderTree *folder_tree) config_dir = e_shell_backend_get_config_dir (backend); g_return_if_fail (config_dir != NULL); - filename = g_build_filename (config_dir, "state", NULL); + filename = g_build_filename (config_dir, "state.ini", NULL); key_file = g_key_file_new (); g_key_file_load_from_file (key_file, filename, 0, &error); diff --git a/mail/mail-config.c b/mail/mail-config.c index 8c76353478..8bbd9fc119 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -535,7 +535,7 @@ mail_config_folder_to_cachename (CamelFolder *folder, const gchar *prefix) config_dir = mail_session_get_config_dir (); url = mail_config_folder_to_safe_url (folder); basename = g_strdup_printf ("%s%s", prefix, url); - filename = g_build_filename (config_dir, basename, NULL); + filename = g_build_filename (config_dir, "folders", basename, NULL); g_free (basename); g_free (url); diff --git a/mail/mail-session.c b/mail/mail-session.c index 1ccb87cbca..039640109a 100644 --- a/mail/mail-session.c +++ b/mail/mail-session.c @@ -1007,15 +1007,9 @@ mail_session_get_data_dir (void) const gchar * mail_session_get_config_dir (void) { - if (G_UNLIKELY (mail_config_dir == NULL)) { + if (G_UNLIKELY (mail_config_dir == NULL)) mail_config_dir = g_build_filename ( - mail_session_get_data_dir (), "config", NULL); - - if (g_mkdir_with_parents (mail_config_dir, 0777) != 0) - g_critical ( - "Cannot create directory %s: %s", - mail_config_dir, g_strerror (errno)); - } + e_get_user_config_dir (), "mail", NULL); return mail_config_dir; } |