ocarina: Don't scroll if (index < number of visible rows)

This prevents a possible slow down / infinite loop (I never actually let
it finish)

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-03-26 18:33:25 -04:00
parent ee2191fc4f
commit 3cbeb85828
1 changed files with 5 additions and 1 deletions

View File

@ -71,7 +71,11 @@ namespace ocarina
height = area.height;
gtk_tree_view_get_cell_area(GTK_TREE_VIEW(treeview), path, col, &area);
n = height / area.height;
n = index - (n / 2);
if (index < (n / 2))
n = 0;
else
n = index - (n / 2);
for (unsigned int i = 0; i < n; i++)
gtk_tree_path_next(path);