Mercurial > geeqie.yaz
changeset 144:2310066cc55a
fixed preloading images in file list
author | nadvornik |
---|---|
date | Mon, 22 Oct 2007 19:58:47 +0000 |
parents | 0d1bf3ac6cd8 |
children | 8be2cc687304 |
files | src/layout_image.c src/view_file_icon.c src/view_file_list.c |
diffstat | 3 files changed, 25 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/src/layout_image.c Mon Oct 08 19:41:49 2007 +0000 +++ b/src/layout_image.c Mon Oct 22 19:58:47 2007 +0000 @@ -1167,7 +1167,9 @@ { if (!layout_valid(&lw)) return; -/* if (path) +/* +This should be handled at the caller: in vflist_select_image + if (path) { const gchar *old_path;
--- a/src/view_file_icon.c Mon Oct 08 19:41:49 2007 +0000 +++ b/src/view_file_icon.c Mon Oct 22 19:58:47 2007 +0000 @@ -370,35 +370,33 @@ static void vficon_send_layout_select(ViewFileIcon *vfi, IconData *id) { FileData *read_ahead_fd = NULL; - FileData *fd; - - if (!vfi->layout || !id) return; - - fd = id->fd; - + FileData *sel_fd; + FileData *cur_fd; + + if (!vfi->layout || !id || !id->fd) return; + + sel_fd = id->fd; + + cur_fd = layout_image_get_fd(vfi->layout); + if (sel_fd == cur_fd) return; /* no change */ + if (enable_read_ahead) { - FileData *fd_n; gint row; row = g_list_index(vfi->list, id); - if (row > vficon_index_by_path(vfi, layout_image_get_path(vfi->layout)) && + if (row > vficon_index_by_fd(vfi, cur_fd) && row + 1 < vficon_count(vfi, NULL)) { - fd_n = vficon_index_get_data(vfi, row + 1); + read_ahead_fd = vficon_index_get_data(vfi, row + 1); } else if (row > 0) { - fd_n = vficon_index_get_data(vfi, row - 1); + read_ahead_fd = vficon_index_get_data(vfi, row - 1); } - else - { - fd_n = NULL; - } - if (fd_n) read_ahead_fd = fd_n; } - layout_image_set_with_ahead(vfi->layout, fd, read_ahead_fd); + layout_image_set_with_ahead(vfi->layout, sel_fd, read_ahead_fd); } static void vficon_toggle_filenames(ViewFileIcon *vfi)
--- a/src/view_file_list.c Mon Oct 08 19:41:49 2007 +0000 +++ b/src/view_file_list.c Mon Oct 22 19:58:47 2007 +0000 @@ -665,27 +665,26 @@ { FileData *read_ahead_fd = NULL; gint row; + FileData *cur_fd; if (!sel_fd) return; + + cur_fd = layout_image_get_fd(vfl->layout); + if (sel_fd == cur_fd) return; /* no change */ + row = g_list_index(vfl->list, sel_fd); // FIXME sidecar data if (sel_fd && enable_read_ahead && row >= 0) { - FileData *fd; - if (row > vflist_index_by_path(vfl, layout_image_get_path(vfl->layout)) && + if (row > g_list_index(vfl->list, cur_fd) && row + 1 < vflist_count(vfl, NULL)) { - fd = vflist_index_get_data(vfl, row + 1); + read_ahead_fd = vflist_index_get_data(vfl, row + 1); } else if (row > 0) { - fd = vflist_index_get_data(vfl, row - 1); + read_ahead_fd = vflist_index_get_data(vfl, row - 1); } - else - { - fd = NULL; - } - if (fd) read_ahead_fd = fd; } layout_image_set_with_ahead(vfl->layout, sel_fd, read_ahead_fd);