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/mail-ops.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/mail-ops.c')
-rw-r--r-- | mail/mail-ops.c | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 24a494ddac..4ff12b3955 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -43,7 +43,6 @@ #include "mail-ops.h" #include "mail-tools.h" -#include "e-mail-local.h" #include "e-mail-session.h" #include "e-mail-session-utils.h" @@ -213,18 +212,23 @@ fetch_mail_exec (struct _fetch_mail_msg *m, { struct _filter_mail_msg *fm = (struct _filter_mail_msg *) m; CamelFolder *folder = NULL; + CamelService *service; + CamelSession *session; CamelURL *url; gboolean is_local_delivery; const gchar *uid; gint i; - fm->destination = e_mail_local_get_folder ( - E_MAIL_LOCAL_FOLDER_LOCAL_INBOX); + service = CAMEL_SERVICE (m->store); + session = camel_service_get_session (service); + + fm->destination = e_mail_session_get_local_folder ( + E_MAIL_SESSION (session), E_MAIL_LOCAL_FOLDER_LOCAL_INBOX); if (fm->destination == NULL) goto fail; g_object_ref (fm->destination); - url = camel_service_new_camel_url (CAMEL_SERVICE (m->store)); + url = camel_service_new_camel_url (service); is_local_delivery = em_utils_is_local_delivery_mbox_file (url); if (is_local_delivery) { @@ -250,7 +254,7 @@ fetch_mail_exec (struct _fetch_mail_msg *m, g_free (path); g_free (url_string); } else { - uid = camel_service_get_uid (CAMEL_SERVICE (m->store)); + uid = camel_service_get_uid (service); folder = fm->source_folder = e_mail_session_get_inbox_sync ( @@ -344,7 +348,7 @@ fail: * there is no need to keep the connection alive forever */ if (!is_local_delivery) em_utils_disconnect_service_sync ( - CAMEL_SERVICE (m->store), TRUE, cancellable, NULL); + service, TRUE, cancellable, NULL); } static void @@ -670,7 +674,8 @@ mail_send_message (struct _send_queue_msg *m, } if (!folder) { - folder = e_mail_local_get_folder (E_MAIL_LOCAL_FOLDER_SENT); + folder = e_mail_session_get_local_folder ( + session, E_MAIL_LOCAL_FOLDER_SENT); g_object_ref (folder); } @@ -683,7 +688,8 @@ mail_send_message (struct _send_queue_msg *m, if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) goto exit; - sent_folder = e_mail_local_get_folder (E_MAIL_LOCAL_FOLDER_SENT); + sent_folder = e_mail_session_get_local_folder ( + session, E_MAIL_LOCAL_FOLDER_SENT); if (folder != sent_folder) { const gchar *description; @@ -801,6 +807,7 @@ send_queue_exec (struct _send_queue_msg *m, GCancellable *cancellable, GError **error) { + EMailSession *session; CamelFolder *sent_folder; GPtrArray *uids, *send_uids = NULL; gint i, j; @@ -808,7 +815,11 @@ send_queue_exec (struct _send_queue_msg *m, d(printf("sending queue\n")); - sent_folder = e_mail_local_get_folder (E_MAIL_LOCAL_FOLDER_SENT); + session = e_mail_backend_get_session (m->backend); + + sent_folder = + e_mail_session_get_local_folder ( + session, E_MAIL_LOCAL_FOLDER_SENT); if (!(uids = camel_folder_get_uids (m->queue))) return; @@ -1489,19 +1500,25 @@ expunge_folder_exec (struct _sync_folder_msg *m, GCancellable *cancellable, GError **error) { + EMailSession *session; CamelFolder *local_inbox; - CamelStore *local_store; CamelStore *parent_store; gboolean is_local_inbox_or_trash; + gboolean store_is_local; gboolean success = TRUE; + const gchar *uid; - local_inbox = e_mail_local_get_folder (E_MAIL_LOCAL_FOLDER_INBOX); - is_local_inbox_or_trash = (m->folder == local_inbox); - - local_store = e_mail_local_get_store (); + session = e_mail_backend_get_session (m->backend); parent_store = camel_folder_get_parent_store (m->folder); + uid = camel_service_get_uid (CAMEL_SERVICE (parent_store)); + store_is_local = (g_strcmp0 (uid, E_MAIL_SESSION_LOCAL_UID) == 0); + + local_inbox = + e_mail_session_get_local_folder ( + session, E_MAIL_LOCAL_FOLDER_INBOX); + is_local_inbox_or_trash = (m->folder == local_inbox); - if (!is_local_inbox_or_trash && local_store == parent_store) { + if (store_is_local && !is_local_inbox_or_trash) { CamelFolder *trash; trash = camel_store_get_trash_folder_sync ( @@ -1591,7 +1608,7 @@ empty_trash_exec (struct _empty_trash_msg *m, return; /* do this before expunge, to know which messages will be expunged */ - if (g_strcmp0 (uid, "local") == 0) + if (g_strcmp0 (uid, E_MAIL_SESSION_LOCAL_UID) == 0) success = expunge_pop3_stores ( trash, m->backend, cancellable, error); |