aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-04-14 18:33:38 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-04-14 18:33:38 +0800
commit783645304dffa63ba978ceec1874f6e9cd7f419a (patch)
tree3582bc79db91d67c6f4aa4491daa45a2a8d725ee /mail
parent3cf228772512334661adb91a1a709b6a2962651f (diff)
downloadgsoc2013-evolution-783645304dffa63ba978ceec1874f6e9cd7f419a.tar
gsoc2013-evolution-783645304dffa63ba978ceec1874f6e9cd7f419a.tar.gz
gsoc2013-evolution-783645304dffa63ba978ceec1874f6e9cd7f419a.tar.bz2
gsoc2013-evolution-783645304dffa63ba978ceec1874f6e9cd7f419a.tar.lz
gsoc2013-evolution-783645304dffa63ba978ceec1874f6e9cd7f419a.tar.xz
gsoc2013-evolution-783645304dffa63ba978ceec1874f6e9cd7f419a.tar.zst
gsoc2013-evolution-783645304dffa63ba978ceec1874f6e9cd7f419a.zip
ugh, use the queued thread to get the folder, otherwise we can get folders
2004-04-14 Not Zed <NotZed@Ximian.com> * em-folder-view.c (emfv_set_folder_uri): ugh, use the queued thread to get the folder, otherwise we can get folders set on the display out of order. * message-list.c (message_list_set_search): if we set this while frozen, save the search elsewhere. (message_list_thaw): if we had a frozen-time search, use it when we regenerate. * em-folder-browser.c (emfb_set_folder): freeze/thaw the messagelist around changes so we don't have multiple updates fire off changing folders. (emfb_activate): remove an unused variable i never used. * message-list.c (message_list_freeze, message_list_thaw): lock some updates to the ui, so you can do things like set folder and search atomically. (message_list_set_threaded, message_list_set_hidedeleted) (message_list_set_search, message_list_hide_uids) (message_list_hide_clear, message_list_set_folder): dont refresh the list if we're frozen. svn path=/trunk/; revision=25458
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog22
-rw-r--r--mail/em-folder-browser.c6
-rw-r--r--mail/em-folder-view.c2
-rw-r--r--mail/message-list.c45
-rw-r--r--mail/message-list.h10
5 files changed, 74 insertions, 11 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index b210c34123..aba87e47a2 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,27 @@
2004-04-14 Not Zed <NotZed@Ximian.com>
+ * em-folder-view.c (emfv_set_folder_uri): ugh, use the queued
+ thread to get the folder, otherwise we can get folders set on the
+ display out of order.
+
+ * message-list.c (message_list_set_search): if we set this while
+ frozen, save the search elsewhere.
+ (message_list_thaw): if we had a frozen-time search, use it when
+ we regenerate.
+
+ * em-folder-browser.c (emfb_set_folder): freeze/thaw the
+ messagelist around changes so we don't have multiple updates fire
+ off changing folders.
+ (emfb_activate): remove an unused variable i never used.
+
+ * message-list.c (message_list_freeze, message_list_thaw): lock
+ some updates to the ui, so you can do things like set folder and
+ search atomically.
+ (message_list_set_threaded, message_list_set_hidedeleted)
+ (message_list_set_search, message_list_hide_uids)
+ (message_list_hide_clear, message_list_set_folder): dont refresh
+ the list if we're frozen.
+
* mail-component.c (impl_createControls): remove debug comment.
** See #56641.
diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c
index 38eece3e5d..3da05dd3da 100644
--- a/mail/em-folder-browser.c
+++ b/mail/em-folder-browser.c
@@ -916,6 +916,8 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri)
EMFolderBrowser *emfb = (EMFolderBrowser *) emfv;
struct _EMFolderBrowserPrivate *p = emfb->priv;
+ message_list_freeze(emfv->list);
+
emfb_parent->set_folder(emfv, folder, uri);
/* This is required since we get activated the first time
@@ -968,6 +970,8 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri)
if (emfv->uic)
emfb_create_view_menus (emfb, emfv->uic);
}
+
+ message_list_thaw(emfv->list);
}
/* TODO: All this mess should sit directly on MessageList, but it would
@@ -1012,7 +1016,7 @@ emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act)
if (act) {
GConfClient *gconf;
- gboolean state, newstate;
+ gboolean state;
char *sstate;
gconf = mail_config_get_gconf_client ();
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index 83523b0782..f2be4ea56d 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -418,7 +418,7 @@ emfv_got_folder(char *uri, CamelFolder *folder, void *data)
static void
emfv_set_folder_uri(EMFolderView *emfv, const char *uri)
{
- mail_get_folder(uri, 0, emfv_got_folder, emfv, mail_thread_new);
+ mail_get_folder(uri, 0, emfv_got_folder, emfv, mail_thread_queued);
}
static void
diff --git a/mail/message-list.c b/mail/message-list.c
index 645c16933a..a8e2e85d58 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -1686,6 +1686,7 @@ message_list_finalise (GObject *object)
message_list->hidden_pool = NULL;
}
+ g_free(message_list->frozen_search);
g_free(message_list->cursor_uid);
g_mutex_free(message_list->hide_lock);
@@ -2592,7 +2593,8 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const c
message_list->hidejunk = junk_folder && !(folder->folder_flags & CAMEL_FOLDER_IS_JUNK) && !(folder->folder_flags & CAMEL_FOLDER_IS_TRASH);
load_hide_state (message_list);
- mail_regen_list (message_list, message_list->search, NULL, NULL);
+ if (message_list->frozen == 0)
+ mail_regen_list (message_list, message_list->search, NULL, NULL);
}
}
@@ -2771,6 +2773,25 @@ message_list_get_selected(MessageList *ml)
return data.uids;
}
+void
+message_list_freeze(MessageList *ml)
+{
+ ml->frozen++;
+}
+
+void
+message_list_thaw(MessageList *ml)
+{
+ g_assert(ml->frozen != 0);
+
+ ml->frozen--;
+ if (ml->frozen == 0) {
+ mail_regen_list(ml, ml->frozen_search?ml->frozen_search:ml->search, NULL, NULL);
+ g_free(ml->frozen_search);
+ ml->frozen_search = NULL;
+ }
+}
+
void message_list_free_uids(MessageList *ml, GPtrArray *uids)
{
int i;
@@ -2787,7 +2808,8 @@ message_list_set_threaded (MessageList *ml, gboolean threaded)
if (ml->threaded != threaded) {
ml->threaded = threaded;
- mail_regen_list (ml, ml->search, NULL, NULL);
+ if (ml->frozen == 0)
+ mail_regen_list (ml, ml->search, NULL, NULL);
}
}
@@ -2797,7 +2819,8 @@ message_list_set_hidedeleted (MessageList *ml, gboolean hidedeleted)
if (ml->hidedeleted != hidedeleted) {
ml->hidedeleted = hidedeleted;
- mail_regen_list (ml, ml->search, NULL, NULL);
+ if (ml->frozen == 0)
+ mail_regen_list (ml, ml->search, NULL, NULL);
}
}
@@ -2815,8 +2838,13 @@ message_list_set_search (MessageList *ml, const char *search)
camel_folder_thread_messages_unref(ml->thread_tree);
ml->thread_tree = NULL;
}
-
- mail_regen_list (ml, search, NULL, NULL);
+
+ if (ml->frozen == 0)
+ mail_regen_list (ml, search, NULL, NULL);
+ else {
+ g_free(ml->frozen_search);
+ ml->frozen_search = g_strdup(search);
+ }
}
/* returns the number of messages displayable *after* expression hiding has taken place */
@@ -2862,7 +2890,6 @@ message_list_hidden(MessageList *ml)
return hidden;
}
-
/* add a new expression to hide, or set the range.
@expr: A new search expression - all matching messages will be hidden. May be %NULL.
@lower: Use ML_HIDE_NONE_START to specify no messages hidden from the start of the list.
@@ -2918,7 +2945,8 @@ message_list_hide_uids (MessageList *ml, GPtrArray *uids)
MESSAGE_LIST_UNLOCK (ml, hide_lock);
/* save this here incase the user pops up another window, so they are consistent */
save_hide_state(ml);
- mail_regen_list (ml, ml->search, NULL, NULL);
+ if (ml->frozen == 0)
+ mail_regen_list (ml, ml->search, NULL, NULL);
break;
}
}
@@ -2946,7 +2974,8 @@ message_list_hide_clear (MessageList *ml)
/* save this here incase the user pops up another window, so they are consistent */
save_hide_state(ml);
- mail_regen_list (ml, ml->search, NULL, NULL);
+ if (ml->frozen == 0)
+ mail_regen_list (ml, ml->search, NULL, NULL);
}
#define HIDE_STATE_VERSION (1)
diff --git a/mail/message-list.h b/mail/message-list.h
index 5d88d28692..8c47a12ab2 100644
--- a/mail/message-list.h
+++ b/mail/message-list.h
@@ -119,7 +119,10 @@ struct _MessageList {
/* is the message-list object in a destroyed state? */
guint destroyed : 1;
-
+
+ /* frozen count */
+ guint frozen:16;
+
/* Where the ETree cursor is. */
int cursor_row;
char *cursor_uid;
@@ -134,6 +137,8 @@ struct _MessageList {
GList *regen;
char *pending_select_uid; /* set if we were busy regnerating while we had a select come in */
+ char *frozen_search; /* to save search took place while we were frozen */
+
/* the current camel folder thread tree, if any */
struct _CamelFolderThread *thread_tree;
@@ -166,6 +171,9 @@ void message_list_foreach (MessageList *message_list,
MessageListForeachFunc callback,
gpointer user_data);
+void message_list_freeze(MessageList *ml);
+void message_list_thaw(MessageList *ml);
+
GPtrArray *message_list_get_selected(MessageList *ml);
void message_list_free_uids(MessageList *ml, GPtrArray *uids);