diff options
author | Dan Winship <danw@src.gnome.org> | 2000-08-13 07:07:19 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-08-13 07:07:19 +0800 |
commit | 9178fed291ee57d90636be4f0ca69db80b61df4b (patch) | |
tree | 7a79aca62d1fb5b689524bba2377efd9b20e1fef /mail/message-list.c | |
parent | 031bffff9cf122ac2014d364c249d7e894929bbc (diff) | |
download | gsoc2013-evolution-9178fed291ee57d90636be4f0ca69db80b61df4b.tar gsoc2013-evolution-9178fed291ee57d90636be4f0ca69db80b61df4b.tar.gz gsoc2013-evolution-9178fed291ee57d90636be4f0ca69db80b61df4b.tar.bz2 gsoc2013-evolution-9178fed291ee57d90636be4f0ca69db80b61df4b.tar.lz gsoc2013-evolution-9178fed291ee57d90636be4f0ca69db80b61df4b.tar.xz gsoc2013-evolution-9178fed291ee57d90636be4f0ca69db80b61df4b.tar.zst gsoc2013-evolution-9178fed291ee57d90636be4f0ca69db80b61df4b.zip |
Don't clear the tree here. If two "folder_changed"s arrive in close
* message-list.c (cleanup_regenerate_messagelist): Don't clear the
tree here. If two "folder_changed"s arrive in close succession,
then one possible ordering of events is
cleanup_regenerate_messagelist, cleanup_regenerate_messagelist,
cleanup_thread_messages, cleanup_thread_messages. Which would
result in the message list being filled in twice without being
cleared in between. So don't clear it until the rebuilding
function itself is called.
(clear_tree): New function to empty out the ETreeModel in the
message list.
(build_tree): Change to simpler interface. Call clear_tree.
(build_subtree): Does most of the work of the old build_tree
(build_flat): Remove unused arg. Call clear_tree.
* message-thread.c (cleanup_thread_messages): Update for
build_tree interface change.
svn path=/trunk/; revision=4787
Diffstat (limited to 'mail/message-list.c')
-rw-r--r-- | mail/message-list.c | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/mail/message-list.c b/mail/message-list.c index 7e9c28e23c..6cbff44481 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -791,11 +791,35 @@ message_list_new (FolderBrowser *parent_folder_browser) return BONOBO_OBJECT (message_list); } +static void +clear_tree (MessageList *ml) +{ + ETreeModel *etm = E_TREE_MODEL (ml->table_model); + + if (ml->tree_root) + e_tree_model_node_remove (etm, ml->tree_root); + ml->tree_root = + e_tree_model_node_insert (etm, NULL, 0, ml); + e_tree_model_node_set_expanded (etm, ml->tree_root, TRUE); +} + /* only call if we have a tree model */ /* builds the tree structure */ +static void build_subtree (MessageList *ml, ETreePath *parent, + struct _container *c, int *row); + static void -build_tree (MessageList *ml, ETreePath *parent, struct _container *c, - int *row) +build_tree (MessageList *ml, struct _container *c) +{ + int row = 0; + + clear_tree (ml); + build_subtree (ml, ml->tree_root, c, &row); +} + +static void +build_subtree (MessageList *ml, ETreePath *parent, + struct _container *c, int *row) { ETreeModel *tree = E_TREE_MODEL (ml->table_model); ETreePath *node; @@ -813,20 +837,21 @@ build_tree (MessageList *ml, ETreePath *parent, struct _container *c, if (c->child) { /* by default, open all trees */ e_tree_model_node_set_expanded (tree, node, TRUE); - build_tree (ml, node, c->child, row); + build_subtree (ml, node, c->child, row); } c = c->next; } } static void -build_flat (MessageList *ml, ETreePath *parent, GPtrArray *uids) +build_flat (MessageList *ml, GPtrArray *uids) { ETreeModel *tree = E_TREE_MODEL (ml->table_model); ETreePath *node; char *uid; int i; + clear_tree (ml); for (i = 0; i < uids->len; i++) { uid = g_strdup_printf ("uid:%s", (char *)uids->pdata[i]); node = e_tree_model_node_insert (tree, ml->tree_root, i, uid); @@ -1171,19 +1196,12 @@ static void cleanup_regenerate_messagelist (gpointer in_data, gpointer op_data, return; } - /* Clear the old contents, build the new */ - if (input->ml->tree_root) - e_tree_model_node_remove(etm, input->ml->tree_root); - input->ml->tree_root = - e_tree_model_node_insert(etm, NULL, 0, input->ml); - e_tree_model_node_set_expanded (etm, input->ml->tree_root, TRUE); - if (mail_config_thread_list()) { mail_do_thread_messages (input->ml, data->uids, (gboolean) !(input->search), build_tree); } else { - build_flat (input->ml, input->ml->tree_root, data->uids); + build_flat (input->ml, data->uids); if (input->search) { camel_folder_search_free (input->ml->folder, data->uids); |