Mercurial > pidgin
changeset 16203:4f6a6443a1e3
emit/handle gnttree signals appropriately
author | Richard Nelson <wabz@pidgin.im> |
---|---|
date | Mon, 16 Apr 2007 05:19:07 +0000 |
parents | 36b09c6f7957 |
children | af599ba236ea |
files | finch/libgnt/gntfilesel.c finch/libgnt/gnttree.c |
diffstat | 2 files changed, 13 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/finch/libgnt/gntfilesel.c Mon Apr 16 05:07:21 2007 +0000 +++ b/finch/libgnt/gntfilesel.c Mon Apr 16 05:19:07 2007 +0000 @@ -412,9 +412,11 @@ static void file_sel_changed(GntWidget *widget, gpointer old, gpointer current, GntFileSel *sel) { - g_free(sel->suggest); - sel->suggest = NULL; - update_location(sel); + if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_HAS_FOCUS)) { + g_free(sel->suggest); + sel->suggest = NULL; + update_location(sel); + } } static void
--- 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); } }