diff finch/libgnt/gnttree.c @ 16203:4f6a6443a1e3

emit/handle gnttree signals appropriately
author Richard Nelson <wabz@pidgin.im>
date Mon, 16 Apr 2007 05:19:07 +0000
parents bc280c341679
children f02e611bdb6b
line wrap: on
line diff
--- a/finch/libgnt/gnttree.c	Mon Apr 16 05:07:21 2007 +0000
+++ b/finch/libgnt/gnttree.c	Mon Apr 16 05:19:07 2007 +0000
@@ -47,6 +47,8 @@
 	int span;       /* How many columns does it span? */
 };
 
+static void tree_selection_changed(GntTree *, GntTreeRow *, GntTreeRow *);
+
 static GntWidgetClass *parent_class = NULL;
 static guint signals[SIGS] = { 0 };
 
@@ -340,8 +342,10 @@
 
 	if (tree->top == NULL)
 		tree->top = tree->root;
-	if (tree->current == NULL)
+	if (tree->current == NULL) {
 		tree->current = tree->root;
+		tree_selection_changed(tree, NULL, tree->current);
+	}
 
 	wbkgd(widget->window, COLOR_PAIR(GNT_COLOR_NORMAL));
 
@@ -1394,7 +1398,7 @@
 {
 	int dist;
 	GntTreeRow *row = g_hash_table_lookup(tree->hash, key);
-	if (!row)
+	if (!row || row == tree->current)
 		return;
 
 	if (tree->top == NULL)
@@ -1409,6 +1413,7 @@
 		gnt_tree_scroll(tree, -dist);
 	else
 		redraw_tree(tree);
+	tree_selection_changed(tree, row, tree->current);
 }
 
 void _gnt_tree_init_internals(GntTree *tree, int col)
@@ -1514,6 +1519,7 @@
 		row->collapsed = !expanded;
 		if (GNT_WIDGET(tree)->window)
 			gnt_widget_draw(GNT_WIDGET(tree));
+		g_signal_emit(tree, signals[SIG_COLLAPSED], 0, key, row->collapsed);
 	}
 }