Mercurial > geeqie.yaz
changeset 1627:909bf83bf9a4
reduced jumping of directory tree when user clicks on folders
author | nadvornik |
---|---|
date | Sat, 06 Jun 2009 11:15:09 +0000 |
parents | 94e4a47ccaff |
children | 738b70daa3af |
files | src/view_dir_tree.c |
diffstat | 1 files changed, 11 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/view_dir_tree.c Fri Jun 05 21:52:37 2009 +0000 +++ b/src/view_dir_tree.c Sat Jun 06 11:15:09 2009 +0000 @@ -694,13 +694,10 @@ if (vd_find_row(vd, fd, &iter)) { GtkTreeModel *store; - GtkTreePath *tpath; + GtkTreePath *tpath, *old_tpath; GtkTreeSelection *selection; store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)); - tpath = gtk_tree_model_get_path(store, &iter); - gtk_tree_view_set_cursor(GTK_TREE_VIEW(vd->view), tpath, NULL, FALSE); - gtk_tree_path_free(tpath); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vd->view)); @@ -709,7 +706,16 @@ gtk_tree_selection_select_iter(selection, &iter); selection_is_ok = FALSE; - tree_view_row_make_visible(GTK_TREE_VIEW(vd->view), &iter, TRUE); + gtk_tree_view_get_cursor(GTK_TREE_VIEW(vd->view), &old_tpath, NULL); + tpath = gtk_tree_model_get_path(store, &iter); + + if (!old_tpath || gtk_tree_path_compare(tpath, old_tpath) != 0) + { + /* setting the cursor scrolls the view; do not do that unless it is necessary */ + gtk_tree_view_set_cursor(GTK_TREE_VIEW(vd->view), tpath, NULL, FALSE); + } + gtk_tree_path_free(tpath); + gtk_tree_path_free(old_tpath); } return TRUE;