# HG changeset patch # User Sadrul Habib Chowdhury # Date 1175399218 0 # Node ID 5eb0621e0760fd54ba18ec603878a1728db6cae4 # Parent 05d347516fcd08fd9bc2a11a0f40a99b74222d16 Backspace to jump to parent. diff -r 05d347516fcd -r 5eb0621e0760 finch/libgnt/gnttree.c --- a/finch/libgnt/gnttree.c Fri Mar 30 06:47:54 2007 +0000 +++ b/finch/libgnt/gnttree.c Sun Apr 01 03:46:58 2007 +0000 @@ -567,6 +567,23 @@ } static gboolean +action_move_parent(GntBindable *bind, GList *null) +{ + GntTree *tree = GNT_TREE(bind); + GntTreeRow *row = tree->current; + if (row->parent) { + int dist; + tree->current = row->parent; + if ((dist = get_distance(tree->current, tree->top)) > 0) + gnt_tree_scroll(tree, -dist); + else + redraw_tree(tree); + tree_selection_changed(tree, row, tree->current); + } + return TRUE; +} + +static gboolean action_up(GntBindable *bind, GList *list) { int dist; @@ -845,6 +862,8 @@ gnt_bindable_class_register_action(bindable, "move-down", action_down, GNT_KEY_DOWN, NULL); gnt_bindable_register_binding(bindable, "move-down", GNT_KEY_CTRL_N, NULL); + gnt_bindable_class_register_action(bindable, "move-parent", action_move_parent, + GNT_KEY_BACKSPACE, NULL); gnt_bindable_class_register_action(bindable, "page-up", action_page_up, GNT_KEY_PGUP, NULL); gnt_bindable_class_register_action(bindable, "page-down", action_page_down, @@ -1506,10 +1525,13 @@ int w = gnt_util_onscreen_width(col->text, NULL); if (i == 0 && row->choice) w += 4; + if (i == 0) { + w += find_depth(row) * TAB_SIZE; + } if (widths[i] < w) widths[i] = w; } - row = row->next; + row = get_next(row); } twidth = 1 + 2 * (!GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(tree), GNT_WIDGET_NO_BORDER));