# HG changeset patch # User Sadrul Habib Chowdhury # Date 1265213128 0 # Node ID 7b6933cd7fd3163e666b6bb3eac304801905a9de # Parent 1cf9103727f2ef106e6e36f23a96be358c139d73 move-start (home) and move-last (end) actions for trees. diff -r 1cf9103727f2 -r 7b6933cd7fd3 ChangeLog --- a/ChangeLog Wed Feb 03 05:33:33 2010 +0000 +++ b/ChangeLog Wed Feb 03 16:05:28 2010 +0000 @@ -44,6 +44,12 @@ request form. (Thanks to Florian Zeitz for finding this problem) * Search friends by email-addresses in the buddy list. (Luoh Ren-Shan) + Finch: + * Rebindable 'move-first' and 'move-last' actions for tree widgets. So + it is possible to jump to the first or last entry in the buddy list + (and other such lists) by pressing home or end key (defaults) + respectively. + version 2.6.5 (01/08/2010): libpurple: * TLS certificates are actually stored to the local cache once again diff -r 1cf9103727f2 -r 7b6933cd7fd3 doc/finch.1.in --- a/doc/finch.1.in Wed Feb 03 05:33:33 2010 +0000 +++ b/doc/finch.1.in Wed Feb 03 16:05:28 2010 +0000 @@ -366,6 +366,10 @@ .br backspace = move-parent .br +home = move-first +.br +end = move-last +.br # Following is the default binding for the context-menu .br menu = context-menu diff -r 1cf9103727f2 -r 7b6933cd7fd3 finch/libgnt/gnttree.c --- a/finch/libgnt/gnttree.c Wed Feb 03 05:33:33 2010 +0000 +++ b/finch/libgnt/gnttree.c Wed Feb 03 16:05:28 2010 +0000 @@ -957,6 +957,45 @@ return TRUE; } +static gboolean +move_first_action(GntBindable *bind, GList *null) +{ + GntTree *tree = GNT_TREE(bind); + GntTreeRow *row = tree->root; + GntTreeRow *old = tree->current; + if (row && !row_matches_search(row)) + row = get_next(row); + if (row) { + tree->current = row; + redraw_tree(tree); + if (old != tree->current) + tree_selection_changed(tree, old, tree->current); + } + + return TRUE; +} + +static gboolean +move_last_action(GntBindable *bind, GList *null) +{ + GntTree *tree = GNT_TREE(bind); + GntTreeRow *old = tree->current; + GntTreeRow *row = tree->bottom; + GntTreeRow *next; + + while ((next = get_next(row))) + row = next; + + if (row) { + tree->current = row; + redraw_tree(tree); + if (old != tree->current) + tree_selection_changed(tree, old, tree->current); + } + + return TRUE; +} + static void gnt_tree_set_property(GObject *obj, guint prop_id, const GValue *value, GParamSpec *spec) @@ -1076,6 +1115,10 @@ "/", NULL); gnt_bindable_class_register_action(bindable, "end-search", end_search_action, "\033", NULL); + gnt_bindable_class_register_action(bindable, "move-first", move_first_action, + GNT_KEY_HOME, NULL); + gnt_bindable_class_register_action(bindable, "move-last", move_last_action, + GNT_KEY_END, NULL); gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), bindable); GNTDEBUG;