Mercurial > geeqie.yaz
comparison src/view_dir_tree.c @ 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 |
comparison
equal
deleted
inserted
replaced
1626:94e4a47ccaff | 1627:909bf83bf9a4 |
---|---|
692 if (!fd) return FALSE; | 692 if (!fd) return FALSE; |
693 | 693 |
694 if (vd_find_row(vd, fd, &iter)) | 694 if (vd_find_row(vd, fd, &iter)) |
695 { | 695 { |
696 GtkTreeModel *store; | 696 GtkTreeModel *store; |
697 GtkTreePath *tpath; | 697 GtkTreePath *tpath, *old_tpath; |
698 GtkTreeSelection *selection; | 698 GtkTreeSelection *selection; |
699 | 699 |
700 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)); | 700 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)); |
701 tpath = gtk_tree_model_get_path(store, &iter); | |
702 gtk_tree_view_set_cursor(GTK_TREE_VIEW(vd->view), tpath, NULL, FALSE); | |
703 gtk_tree_path_free(tpath); | |
704 | 701 |
705 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vd->view)); | 702 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vd->view)); |
706 | 703 |
707 /* hack, such that selection is only allowed to be changed from here */ | 704 /* hack, such that selection is only allowed to be changed from here */ |
708 selection_is_ok = TRUE; | 705 selection_is_ok = TRUE; |
709 gtk_tree_selection_select_iter(selection, &iter); | 706 gtk_tree_selection_select_iter(selection, &iter); |
710 selection_is_ok = FALSE; | 707 selection_is_ok = FALSE; |
711 | 708 |
712 tree_view_row_make_visible(GTK_TREE_VIEW(vd->view), &iter, TRUE); | 709 gtk_tree_view_get_cursor(GTK_TREE_VIEW(vd->view), &old_tpath, NULL); |
710 tpath = gtk_tree_model_get_path(store, &iter); | |
711 | |
712 if (!old_tpath || gtk_tree_path_compare(tpath, old_tpath) != 0) | |
713 { | |
714 /* setting the cursor scrolls the view; do not do that unless it is necessary */ | |
715 gtk_tree_view_set_cursor(GTK_TREE_VIEW(vd->view), tpath, NULL, FALSE); | |
716 } | |
717 gtk_tree_path_free(tpath); | |
718 gtk_tree_path_free(old_tpath); | |
713 } | 719 } |
714 | 720 |
715 return TRUE; | 721 return TRUE; |
716 } | 722 } |
717 | 723 |