From 4bb8a86c70feba3036b8eb44c9696f099aa4da53 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 5 Sep 2011 19:06:47 +0200 Subject: Bug #655568 - Cursor lost after Collapse all threads called --- mail/message-list.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/mail/message-list.c b/mail/message-list.c index 1c634b91b8..d98f860f8c 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -3330,13 +3330,28 @@ build_tree (MessageList *ml, tree_equal (ml->model, top, thread->tree); } #endif + if (!saveuid && ml->cursor_uid && g_hash_table_lookup (ml->uid_nodemap, ml->cursor_uid)) { + /* this makes sure a visible node is selected, like when + collapsing all nodes and a children had been selected + */ + saveuid = g_strdup (ml->cursor_uid); + } + if (saveuid) { - ETreePath *node = g_hash_table_lookup (ml->uid_nodemap, saveuid); + ETreePath node = g_hash_table_lookup (ml->uid_nodemap, saveuid); if (node == NULL) { g_free (ml->cursor_uid); ml->cursor_uid = NULL; g_signal_emit (ml, message_list_signals[MESSAGE_SELECTED], 0, NULL); } else { + ETree *tree = E_TREE (ml); + ETreePath parent = node; + + while (parent = e_tree_model_node_get_parent (etm, parent), parent) { + if (!e_tree_node_is_expanded (tree, parent)) + node = parent; + } + e_tree_set_cursor (E_TREE (ml), node); } g_free (saveuid); -- cgit