changeset 26509:28795b39d745

- Don't bother changing/signalling the selected row from NULL to NULL - Ensure the selected row is a visible row when searching the tree.
author Richard Nelson <wabz@pidgin.im>
date Wed, 08 Apr 2009 12:35:09 +0000
parents bf5b74b2a483
children d9439f76c118
files finch/libgnt/gnttree.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/finch/libgnt/gnttree.c	Wed Apr 08 09:43:52 2009 +0000
+++ b/finch/libgnt/gnttree.c	Wed Apr 08 12:35:09 2009 +0000
@@ -432,7 +432,7 @@
 
 	if (tree->top == NULL)
 		tree->top = tree->root;
-	if (tree->current == NULL) {
+	if (tree->current == NULL && tree->root != NULL) {
 		tree->current = tree->root;
 		tree_selection_changed(tree, NULL, tree->current);
 	}
@@ -491,6 +491,13 @@
 		tree->top = get_next(tree->top);
 	row = tree->top;
 	scrcol = widget->priv.width - 1 - 2 * pos;  /* exclude the borders and the scrollbar */
+
+	if (tree->current && !row_matches_search(tree->current)) {
+		GntTreeRow *old = tree->current;
+		tree->current = tree->top;
+		tree_selection_changed(tree, old, tree->current);
+	}
+
 	for (i = start + pos; row && i < widget->priv.height - pos;
 				i++, row = get_next(row))
 	{