From 7831e6372af01c47abda3dea82db1d022e3e2623 Mon Sep 17 00:00:00 2001 From: unqwist <> Date: Wed, 18 Oct 2017 17:04:54 +0100 Subject: [PATCH] Fix #356: Select dirlist when entering a directory https://github.com/BestImageViewer/geeqie/issues/356 --- src/view_dir_list.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/src/view_dir_list.c b/src/view_dir_list.c index 73f427cf..a125f47b 100644 --- a/src/view_dir_list.c +++ b/src/view_dir_list.c @@ -320,31 +320,22 @@ gboolean vdlist_set_fd(ViewDir *vd, FileData *dir_fd) ret = vdlist_populate(vd, TRUE); - if (old_path) - { - /* scroll to make last path visible */ - FileData *found = NULL; - GList *work; - - work = VDLIST(vd)->list; - while (work && !found) - { - FileData *fd = work->data; - if (strcmp(old_path, fd->name) == 0) found = fd; - work = work->next; - } - - if (found) vdlist_scroll_to_row(vd, found, 0.5); - - g_free(old_path); - return ret; - } + /* scroll to make last path visible */ + FileData *found = NULL; + GList *work; - if (gtk_widget_get_realized(vd->view)) + work = VDLIST(vd)->list; + while (work && !found) { - gtk_tree_view_scroll_to_point(GTK_TREE_VIEW(vd->view), 0, 0); + FileData *fd = work->data; + if (!old_path || strcmp(old_path, fd->name) == 0) found = fd; + work = work->next; } + if (found) vdlist_scroll_to_row(vd, found, 0.5); + + if (old_path) g_free(old_path); + return ret; } -- 2.20.1