Keep the selected dive visible in the divelist

This patch makes the divelist behave more as you would expect it as you
scroll up and down through its entries.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Linus Torvalds 2013-01-01 11:49:48 -08:00 committed by Dirk Hohndel
parent a58d470bad
commit bc16f06536

View file

@ -2682,6 +2682,7 @@ void select_next_dive(void)
}
treepath = gtk_tree_model_get_path(MODEL(dive_list), nextiter);
gtk_tree_view_expand_to_path(GTK_TREE_VIEW(dive_list.tree_view), treepath);
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(dive_list.tree_view), treepath, NULL, FALSE, 0, 0);
gtk_tree_selection_select_iter(selection, nextiter);
gtk_tree_selection_unselect_iter(selection, iter);
gtk_tree_path_free(treepath);
@ -2722,6 +2723,7 @@ void select_prev_dive(void)
return;
}
gtk_tree_view_expand_to_path(GTK_TREE_VIEW(dive_list.tree_view), treepath);
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(dive_list.tree_view), treepath, NULL, FALSE, 0, 0);
gtk_tree_selection_select_iter(selection, &previter);
gtk_tree_selection_unselect_iter(selection, iter);
gtk_tree_path_free(treepath);