Fix #356: Select dirlist when entering a directory
authorunqwist <>
Wed, 18 Oct 2017 16:04:54 +0000 (17:04 +0100)
committerColin Clark <colin.clark@cclark.uk>
Wed, 18 Oct 2017 16:04:54 +0000 (17:04 +0100)
https://github.com/BestImageViewer/geeqie/issues/356

src/view_dir_list.c

index 73f427c..a125f47 100644 (file)
@@ -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;
 }