aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2012-05-31 00:46:49 +0800
committerMilan Crha <mcrha@redhat.com>2012-05-31 00:46:49 +0800
commitc88d3170304e1892b221d0581a3cd3c767de4281 (patch)
treebe7750049e7dca9b187bea5347556d2007ba5509 /mail
parentb9d8defa321ea315ca15e59c9df33845563d5042 (diff)
downloadgsoc2013-evolution-c88d3170304e1892b221d0581a3cd3c767de4281.tar
gsoc2013-evolution-c88d3170304e1892b221d0581a3cd3c767de4281.tar.gz
gsoc2013-evolution-c88d3170304e1892b221d0581a3cd3c767de4281.tar.bz2
gsoc2013-evolution-c88d3170304e1892b221d0581a3cd3c767de4281.tar.lz
gsoc2013-evolution-c88d3170304e1892b221d0581a3cd3c767de4281.tar.xz
gsoc2013-evolution-c88d3170304e1892b221d0581a3cd3c767de4281.tar.zst
gsoc2013-evolution-c88d3170304e1892b221d0581a3cd3c767de4281.zip
Adapt to vFolder changes from evolution-data-server
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-reader.c9
-rw-r--r--mail/message-list.c36
2 files changed, 36 insertions, 9 deletions
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 2cc78f86b8..a5a66e3e87 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -3042,8 +3042,8 @@ mail_reader_set_folder (EMailReader *reader,
shell = e_shell_backend_get_shell (E_SHELL_BACKEND (backend));
- /* Only synchronize the folder if we're online. */
- if (previous_folder != NULL && e_shell_get_online (shell))
+ /* Only synchronize the real folder if we're online. */
+ if (previous_folder != NULL && (CAMEL_IS_VEE_FOLDER (previous_folder) || e_shell_get_online (shell)))
mail_sync_folder (previous_folder, NULL, NULL);
/* Skip the rest if we're already viewing the folder. */
@@ -3059,6 +3059,11 @@ mail_reader_set_folder (EMailReader *reader,
priv->folder_was_just_selected = (folder != NULL);
+ /* this is to make sure any post-poned changes in Search Folders
+ will be propagated on folder selection */
+ if (folder && CAMEL_IS_VEE_FOLDER (folder))
+ mail_sync_folder (folder, NULL, NULL);
+
message_list_set_folder (
MESSAGE_LIST (message_list), folder, outgoing);
diff --git a/mail/message-list.c b/mail/message-list.c
index 89c7f94fee..94957c0399 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -4447,6 +4447,7 @@ struct sort_array_data {
GPtrArray *sort_columns; /* struct sort_column_data in order of sorting */
GHashTable *message_infos; /* uid -> struct sort_message_info_data */
gpointer cmp_cache;
+ GCancellable *cancellable;
};
static gint
@@ -4470,10 +4471,16 @@ cmp_array_uids (gconstpointer a,
g_return_val_if_fail (md2 != NULL, 0);
g_return_val_if_fail (md2->mi != NULL, 0);
- if (!sort_data->ml || sort_data->folder != sort_data->ml->folder)
+ if (!sort_data->ml ||
+ sort_data->folder != sort_data->ml->folder ||
+ g_cancellable_is_cancelled (sort_data->cancellable))
return 0;
- for (i = 0; res == 0 && i < sort_data->sort_columns->len; i++) {
+ for (i = 0;
+ res == 0
+ && i < sort_data->sort_columns->len
+ && !g_cancellable_is_cancelled (sort_data->cancellable);
+ i++) {
gpointer v1, v2;
struct sort_column_data *scol = g_ptr_array_index (sort_data->sort_columns, i);
@@ -4524,7 +4531,8 @@ free_message_info_data (gpointer uid,
static void
ml_sort_uids_by_tree (MessageList *ml,
- GPtrArray *uids)
+ GPtrArray *uids,
+ GCancellable *cancellable)
{
ETreeTableAdapter *adapter;
ETableSortInfo *sort_info;
@@ -4532,6 +4540,9 @@ ml_sort_uids_by_tree (MessageList *ml,
struct sort_array_data sort_data;
guint i, len;
+ if (g_cancellable_is_cancelled (cancellable))
+ return;
+
g_return_if_fail (ml != NULL);
g_return_if_fail (ml->folder != NULL);
g_return_if_fail (uids != NULL);
@@ -4554,8 +4565,13 @@ ml_sort_uids_by_tree (MessageList *ml,
sort_data.sort_columns = g_ptr_array_sized_new (len);
sort_data.message_infos = g_hash_table_new (g_str_hash, g_str_equal);
sort_data.cmp_cache = e_table_sorting_utils_create_cmp_cache ();
+ sort_data.cancellable = cancellable;
- for (i = 0; i < len && ml->folder == sort_data.folder; i++) {
+ for (i = 0;
+ i < len
+ && ml->folder == sort_data.folder
+ && !g_cancellable_is_cancelled (cancellable);
+ i++) {
ETableSortColumn scol;
struct sort_column_data *data = g_new0 (struct sort_column_data, 1);
@@ -4571,7 +4587,11 @@ ml_sort_uids_by_tree (MessageList *ml,
camel_folder_summary_prepare_fetch_all (ml->folder->summary, NULL);
- for (i = 0; i < uids->len && ml->folder == sort_data.folder; i++) {
+ for (i = 0;
+ i < uids->len
+ && ml->folder == sort_data.folder
+ && !g_cancellable_is_cancelled (cancellable);
+ i++) {
gchar *uid;
CamelMessageInfo *mi;
struct sort_message_info_data *md;
@@ -4590,9 +4610,11 @@ ml_sort_uids_by_tree (MessageList *ml,
g_hash_table_insert (sort_data.message_infos, uid, md);
}
- if (sort_data.folder == ml->folder)
+ if (sort_data.folder == ml->folder && !g_cancellable_is_cancelled (cancellable))
g_qsort_with_data (uids->pdata, uids->len, sizeof (gpointer), cmp_array_uids, &sort_data);
+ camel_folder_summary_unlock (sort_data.folder->summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+
g_hash_table_foreach (sort_data.message_infos, (GHFunc) free_message_info_data, &sort_data);
g_hash_table_destroy (sort_data.message_infos);
@@ -4745,7 +4767,7 @@ regen_list_exec (struct _regen_list_msg *m,
if (!g_cancellable_is_cancelled (cancellable)) {
/* update/build a new tree */
if (m->dotree) {
- ml_sort_uids_by_tree (m->ml, uids);
+ ml_sort_uids_by_tree (m->ml, uids, cancellable);
if (m->tree)
camel_folder_thread_messages_apply (m->tree, uids);