Mercurial > pidgin.yaz
comparison finch/libgnt/gnttree.c @ 29334:7b6933cd7fd3
move-start (home) and move-last (end) actions for trees.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 03 Feb 2010 16:05:28 +0000 |
parents | a18f421696dc |
children | a8614b855c39 |
comparison
equal
deleted
inserted
replaced
29333:1cf9103727f2 | 29334:7b6933cd7fd3 |
---|---|
952 if (tree->priv->search == NULL) | 952 if (tree->priv->search == NULL) |
953 return FALSE; | 953 return FALSE; |
954 GNT_WIDGET_UNSET_FLAGS(GNT_WIDGET(tree), GNT_WIDGET_DISABLE_ACTIONS); | 954 GNT_WIDGET_UNSET_FLAGS(GNT_WIDGET(tree), GNT_WIDGET_DISABLE_ACTIONS); |
955 end_search(tree); | 955 end_search(tree); |
956 redraw_tree(tree); | 956 redraw_tree(tree); |
957 return TRUE; | |
958 } | |
959 | |
960 static gboolean | |
961 move_first_action(GntBindable *bind, GList *null) | |
962 { | |
963 GntTree *tree = GNT_TREE(bind); | |
964 GntTreeRow *row = tree->root; | |
965 GntTreeRow *old = tree->current; | |
966 if (row && !row_matches_search(row)) | |
967 row = get_next(row); | |
968 if (row) { | |
969 tree->current = row; | |
970 redraw_tree(tree); | |
971 if (old != tree->current) | |
972 tree_selection_changed(tree, old, tree->current); | |
973 } | |
974 | |
975 return TRUE; | |
976 } | |
977 | |
978 static gboolean | |
979 move_last_action(GntBindable *bind, GList *null) | |
980 { | |
981 GntTree *tree = GNT_TREE(bind); | |
982 GntTreeRow *old = tree->current; | |
983 GntTreeRow *row = tree->bottom; | |
984 GntTreeRow *next; | |
985 | |
986 while ((next = get_next(row))) | |
987 row = next; | |
988 | |
989 if (row) { | |
990 tree->current = row; | |
991 redraw_tree(tree); | |
992 if (old != tree->current) | |
993 tree_selection_changed(tree, old, tree->current); | |
994 } | |
995 | |
957 return TRUE; | 996 return TRUE; |
958 } | 997 } |
959 | 998 |
960 static void | 999 static void |
961 gnt_tree_set_property(GObject *obj, guint prop_id, const GValue *value, | 1000 gnt_tree_set_property(GObject *obj, guint prop_id, const GValue *value, |
1074 GNT_KEY_PGDOWN, NULL); | 1113 GNT_KEY_PGDOWN, NULL); |
1075 gnt_bindable_class_register_action(bindable, "start-search", start_search, | 1114 gnt_bindable_class_register_action(bindable, "start-search", start_search, |
1076 "/", NULL); | 1115 "/", NULL); |
1077 gnt_bindable_class_register_action(bindable, "end-search", end_search_action, | 1116 gnt_bindable_class_register_action(bindable, "end-search", end_search_action, |
1078 "\033", NULL); | 1117 "\033", NULL); |
1118 gnt_bindable_class_register_action(bindable, "move-first", move_first_action, | |
1119 GNT_KEY_HOME, NULL); | |
1120 gnt_bindable_class_register_action(bindable, "move-last", move_last_action, | |
1121 GNT_KEY_END, NULL); | |
1079 | 1122 |
1080 gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), bindable); | 1123 gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), bindable); |
1081 GNTDEBUG; | 1124 GNTDEBUG; |
1082 } | 1125 } |
1083 | 1126 |