diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-12-09 23:34:55 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-12-11 10:34:19 +0800 |
commit | 7c0c40f83317228e0a725bfb5ca8854339d25588 (patch) | |
tree | db1197dd9f336e175c590c3a41201dfa78ee303e /mail/e-mail-migrate.c | |
parent | 2f32e1cc68cd416f4530ecc3d2ff08b0e6498d45 (diff) | |
download | gsoc2013-evolution-7c0c40f83317228e0a725bfb5ca8854339d25588.tar.gz gsoc2013-evolution-7c0c40f83317228e0a725bfb5ca8854339d25588.tar.zst gsoc2013-evolution-7c0c40f83317228e0a725bfb5ca8854339d25588.zip |
Reorder accounts by drag-and-drop.
This implements https://bugzilla.gnome.org/show_bug.cgi?id=663527#c3.
Account reordering is now done by drag-and-drop instead of up/down
buttons.
Turned out to be a wee bit more complicated than I initially thought.
This scraps EAccountManager and EAccountTreeView and replaces them with
new classes centered around EMailAccountStore, which EMailSession owns.
EMailAccountStore is the model behind the account list in Preferences.
The folder tree model now uses it to sort its own top-level rows using
gtk_tree_path_compare(). It also broadcasts account operations through
signals so we don't have to rely so heavily on EAccountList signals,
since EAccountList is going away soon.
Also as part of this work, the e-mail-local.h and e-mail-store.h APIs
have been merged into EMailSession and MailFolderCache.
Diffstat (limited to 'mail/e-mail-migrate.c')
-rw-r--r-- | mail/e-mail-migrate.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/mail/e-mail-migrate.c b/mail/e-mail-migrate.c index f3ce503012..fdf5684e0a 100644 --- a/mail/e-mail-migrate.c +++ b/mail/e-mail-migrate.c @@ -64,8 +64,6 @@ #include "e-mail-backend.h" #include "e-mail-folder-utils.h" -#include "e-mail-local.h" -#include "e-mail-store.h" #include "em-utils.h" #define d(x) x @@ -277,7 +275,7 @@ emm_setup_initial (const gchar *data_dir) d(printf("Setting up initial mail tree\n")); - base = g_build_filename(data_dir, "local", NULL); + base = g_build_filename (data_dir, "local", NULL); if (g_mkdir_with_parents (base, 0700) == -1 && errno != EEXIST) { g_free (base); return FALSE; @@ -671,7 +669,7 @@ create_mbox_account (EShellBackend *shell_backend, { EMailBackend *mail_backend; EMailSession *mail_session; - CamelStore *store; + CamelService *service; CamelURL *url; EAccountList *accounts; EAccount *account; @@ -682,9 +680,6 @@ create_mbox_account (EShellBackend *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; @@ -716,15 +711,20 @@ create_mbox_account (EShellBackend *shell_backend, goto exit; } + /* This will also add it to the EMailSession. */ e_account_list_add (accounts, account); - store = e_mail_store_add_by_account (mail_session, account); - folder_uri = e_mail_folder_uri_build (store, "Sent"); + service = camel_session_get_service ( + CAMEL_SESSION (mail_session), account->uid); + + folder_uri = e_mail_folder_uri_build ( + CAMEL_STORE (service), "Sent"); e_account_set_string ( account, E_ACCOUNT_SENT_FOLDER_URI, folder_uri); g_free (folder_uri); - folder_uri = e_mail_folder_uri_build (store, "Drafts"); + folder_uri = e_mail_folder_uri_build ( + CAMEL_STORE (service), "Drafts"); e_account_set_string ( account, E_ACCOUNT_DRAFTS_FOLDER_URI, folder_uri); g_free (folder_uri); @@ -743,6 +743,8 @@ exit: static void change_sent_and_drafts_local_folders (EShellBackend *shell_backend) { + EMailBackend *backend; + EMailSession *session; EAccountList *accounts; EIterator *iter; const gchar *data_dir; @@ -754,6 +756,9 @@ change_sent_and_drafts_local_folders (EShellBackend *shell_backend) if (!accounts) return; + backend = E_MAIL_BACKEND (shell_backend); + session = e_mail_backend_get_session (backend); + data_dir = e_shell_backend_get_data_dir (shell_backend); tmp_uri = g_strconcat ("mbox:", data_dir, "/", "local", NULL); @@ -797,8 +802,8 @@ change_sent_and_drafts_local_folders (EShellBackend *shell_backend) changed = TRUE; e_account_set_string ( account, E_ACCOUNT_DRAFTS_FOLDER_URI, - e_mail_local_get_folder_uri ( - E_MAIL_LOCAL_FOLDER_DRAFTS)); + e_mail_session_get_local_folder_uri ( + session, E_MAIL_LOCAL_FOLDER_DRAFTS)); } uri = e_account_get_string (account, E_ACCOUNT_SENT_FOLDER_URI); @@ -806,8 +811,8 @@ change_sent_and_drafts_local_folders (EShellBackend *shell_backend) changed = TRUE; e_account_set_string ( account, E_ACCOUNT_SENT_FOLDER_URI, - e_mail_local_get_folder_uri ( - E_MAIL_LOCAL_FOLDER_SENT)); + e_mail_session_get_local_folder_uri ( + session, E_MAIL_LOCAL_FOLDER_SENT)); } } |