diff console/libgnt/gnttree.c @ 13952:841a5ffbfee4

[gaim-migrate @ 16500] uiops for GaimConnections. This only shows an error message for a disconnect. uiops for GaimNotify. I have not done the notifications for searchresults yet. That will require multi-column GntTree's, which will also allow for improved email-notifications. I hope to complete it by next week. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 17 Jul 2006 03:45:24 +0000
parents 25be562aaca8
children 0a0d2a1fd2bc
line wrap: on
line diff
--- a/console/libgnt/gnttree.c	Sun Jul 16 19:08:31 2006 +0000
+++ b/console/libgnt/gnttree.c	Mon Jul 17 03:45:24 2006 +0000
@@ -716,3 +716,24 @@
 	redraw_tree(tree);	/* XXX: It shouldn't be necessary to redraw the whole darned tree */
 }
 
+void gnt_tree_set_selected(GntTree *tree , void *key)
+{
+	int dist;
+	GntTreeRow *row = g_hash_table_lookup(tree->hash, key);
+	if (!row)
+		return;
+
+	if (tree->top == NULL)
+		tree->top = row;
+	if (tree->bottom == NULL)
+		tree->bottom = row;
+
+	tree->current = row;
+	if ((dist = get_distance(tree->current, tree->bottom)) < 0)
+		gnt_tree_scroll(tree, -dist);
+	else if ((dist = get_distance(tree->current, tree->top)) > 0)
+		gnt_tree_scroll(tree, -dist);
+	else
+		redraw_tree(tree);
+}
+