From 28a98b7973e5fd9341fbc7faa6f49b7d0b8d4de9 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 11 Aug 2008 10:08:14 +0000 Subject: ** Fix for bug #519292 2008-08-11 Milan Crha ** Fix for bug #519292 * mail/message-list.c: (load_tree_expand_all): Drop function. * mail/message-list.c: (regen_list_done): Rather use desired expanded state value when creating the tree instead of the default model's value for this to have 'expand/collapse all' commands work better and quicker. * widgets/tablee-tree.h: (e_tree_load_all_expanded_state): * widgets/tablee-tree.c: (e_tree_load_all_expanded_state): * widgets/tablee-tree-table-adapter.h: (e_tree_table_adapter_load_all_expanded_state): * widgets/tablee-tree-table-adapter.c: (e_tree_table_adapter_load_all_expanded_state), (set_expanded_state_func), (set_collapsed_state_func): Drop functions in favor of new functions. * widgets/tablee-tree.h: (e_tree_force_expanded_state): * widgets/tablee-tree.c: (e_tree_force_expanded_state): * widgets/tablee-tree-table-adapter.h: (e_tree_table_adapter_force_expanded_state): * widgets/tablee-tree-table-adapter.c: (e_tree_table_adapter_force_expanded_state), (struct ETreeTableAdapterPriv), (create_gnode), (etta_init): Use either default value of the model to expanded state of new node or use the one which has been set (forced) by new functions. svn path=/trunk/; revision=35954 --- mail/message-list.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'mail/message-list.c') diff --git a/mail/message-list.c b/mail/message-list.c index 73e2d30931..3f43f58cb6 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -1803,16 +1803,6 @@ save_tree_state(MessageList *ml) ml->priv->any_row_changed = FALSE; } -static void -load_tree_expand_all (MessageList *ml, gboolean state) -{ - - if (ml->folder == NULL || ml->tree == NULL) - return; - - e_tree_load_all_expanded_state (ml->tree, state); - save_tree_state (ml); -} static void load_tree_state (MessageList *ml, xmlDoc *expand_state) { @@ -4147,6 +4137,8 @@ regen_list_done (struct _regen_list_msg *m) e_profile_event_emit("list.buildtree", m->folder->full_name, 0); if (m->dotree) { + gboolean forcing_expand_state = m->ml->expand_all || m->ml->collapse_all; + if (m->ml->just_set_folder) { m->ml->just_set_folder = FALSE; if (m->expand_state) { @@ -4156,17 +4148,21 @@ regen_list_done (struct _regen_list_msg *m) } } + if (forcing_expand_state) + e_tree_force_expanded_state (m->ml->tree, m->ml->expand_all ? 1 : -1); + build_tree (m->ml, m->tree, m->changes); if (m->ml->thread_tree) camel_folder_thread_messages_unref(m->ml->thread_tree); m->ml->thread_tree = m->tree; m->tree = NULL; - if (m->ml->expand_all) - load_tree_expand_all (m->ml, TRUE); - else if (m->ml->collapse_all) - load_tree_expand_all (m->ml, FALSE); - else + if (forcing_expand_state) { + if (m->ml->folder != NULL && m->ml->tree != NULL) + save_tree_state (m->ml); + /* do not forget to set this back to use the default value... */ + e_tree_force_expanded_state (m->ml->tree, 0); + } else load_tree_state (m->ml, m->expand_state); m->ml->expand_all = 0; -- cgit