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-send-recv.c | |
parent | 2f32e1cc68cd416f4530ecc3d2ff08b0e6498d45 (diff) | |
download | gsoc2013-evolution-7c0c40f83317228e0a725bfb5ca8854339d25588.tar gsoc2013-evolution-7c0c40f83317228e0a725bfb5ca8854339d25588.tar.gz gsoc2013-evolution-7c0c40f83317228e0a725bfb5ca8854339d25588.tar.bz2 gsoc2013-evolution-7c0c40f83317228e0a725bfb5ca8854339d25588.tar.lz gsoc2013-evolution-7c0c40f83317228e0a725bfb5ca8854339d25588.tar.xz 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-send-recv.c')
-rw-r--r-- | mail/mail-send-recv.c | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index 44c5158631..36c717619b 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -36,7 +36,6 @@ #include "e-util/e-util.h" #include "e-mail-folder-utils.h" -#include "e-mail-local.h" #include "e-mail-session.h" #include "em-event.h" #include "em-filter-rule.h" @@ -164,10 +163,13 @@ free_send_info (struct _send_info *info) } static struct _send_data * -setup_send_data (void) +setup_send_data (EMailBackend *backend) { + EMailSession *session; struct _send_data *data; + session = e_mail_backend_get_session (backend); + if (send_data == NULL) { send_data = data = g_malloc0 (sizeof (*data)); data->lock = g_mutex_new (); @@ -175,8 +177,9 @@ setup_send_data (void) g_str_hash, g_str_equal, (GDestroyNotify) NULL, (GDestroyNotify) free_folder_info); - data->inbox = e_mail_local_get_folder ( - E_MAIL_LOCAL_FOLDER_LOCAL_INBOX); + data->inbox = + e_mail_session_get_local_folder ( + session, E_MAIL_LOCAL_FOLDER_LOCAL_INBOX); g_object_ref (data->inbox); data->active = g_hash_table_new_full ( g_str_hash, g_str_equal, @@ -520,7 +523,7 @@ build_dialog (GtkWindow *parent, gtk_widget_show (scrolled_window); /* must bet setup after send_recv_dialog as it may re-trigger send-recv button */ - data = setup_send_data (); + data = setup_send_data (backend); row = 0; iter = e_list_get_iterator ((EList *) accounts); @@ -810,8 +813,9 @@ receive_done (gpointer data) session = e_mail_backend_get_session (info->backend); - local_outbox = e_mail_local_get_folder ( - E_MAIL_LOCAL_FOLDER_OUTBOX); + local_outbox = + e_mail_session_get_local_folder ( + session, E_MAIL_LOCAL_FOLDER_OUTBOX); service = camel_session_get_service ( CAMEL_SESSION (session), @@ -1126,7 +1130,10 @@ send_receive (GtkWindow *parent, accounts = e_get_account_list (); - local_outbox = e_mail_local_get_folder (E_MAIL_LOCAL_FOLDER_OUTBOX); + local_outbox = + e_mail_session_get_local_folder ( + session, E_MAIL_LOCAL_FOLDER_OUTBOX); + data = build_dialog ( parent, backend, accounts, local_outbox, account, allow_send); @@ -1280,11 +1287,12 @@ auto_account_changed (EAccountList *eal, EAccount *ea, gpointer dummy) { - struct _auto_data *info = g_object_get_data((GObject *)ea, "mail-autoreceive"); + struct _auto_data *info; - g_return_if_fail (info != NULL); + info = g_object_get_data (G_OBJECT (ea), "mail-autoreceive"); - auto_account_commit (info); + if (info != NULL) + auto_account_commit (info); } static void @@ -1394,7 +1402,7 @@ mail_receive_account (EMailBackend *backend, CamelURL *url; send_info_t type = SEND_INVALID; - data = setup_send_data (); + data = setup_send_data (backend); info = g_hash_table_lookup (data->active, account->uid); if (info != NULL) @@ -1450,8 +1458,9 @@ mail_receive_account (EMailBackend *backend, break; case SEND_SEND: /* todo, store the folder in info? */ - local_outbox = e_mail_local_get_folder ( - E_MAIL_LOCAL_FOLDER_OUTBOX); + local_outbox = + e_mail_session_get_local_folder ( + session, E_MAIL_LOCAL_FOLDER_OUTBOX); mail_send_queue ( info->backend, local_outbox, @@ -1487,7 +1496,7 @@ mail_send (EMailBackend *backend) if (account == NULL || account->transport->url == NULL) return; - data = setup_send_data (); + data = setup_send_data (backend); info = g_hash_table_lookup (data->active, SEND_URI_KEY); if (info != NULL) { info->again++; @@ -1525,11 +1534,13 @@ mail_send (EMailBackend *backend) g_hash_table_insert (data->active, (gpointer) SEND_URI_KEY, info); - /* todo, store the folder in info? */ - local_outbox = e_mail_local_get_folder (E_MAIL_LOCAL_FOLDER_OUTBOX); - session = e_mail_backend_get_session (backend); + /* todo, store the folder in info? */ + local_outbox = + e_mail_session_get_local_folder ( + session, E_MAIL_LOCAL_FOLDER_OUTBOX); + service = camel_session_get_service ( CAMEL_SESSION (session), transport_uid); |