[evolution/wip/gsettings] Bug #655568 - Cursor lost after Collapse all threads called



commit 4bb8a86c70feba3036b8eb44c9696f099aa4da53
Author: Milan Crha <mcrha redhat com>
Date:   Mon Sep 5 19:06:47 2011 +0200

    Bug #655568 - Cursor lost after Collapse all threads called

 mail/message-list.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/mail/message-list.c b/mail/message-list.c
index 1c634b9..d98f860 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]