Mercurial > geeqie
changeset 811:f1ce59985518
handle deletion of selected files
author | nadvornik |
---|---|
date | Mon, 09 Jun 2008 19:00:47 +0000 |
parents | 602cec932587 |
children | d29c2d191c58 |
files | src/view_file_icon.c |
diffstat | 1 files changed, 39 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/view_file_icon.c Mon Jun 09 18:28:28 2008 +0000 +++ b/src/view_file_icon.c Mon Jun 09 19:00:47 2008 +0000 @@ -965,6 +965,32 @@ filelist_free(slist); } +static void vficon_select_closest(ViewFile *vf, FileData *sel_fd) +{ + GList *work; + + if (sel_fd->parent) sel_fd = sel_fd->parent; + work = vf->list; + + while (work) + { + gint match; + IconData *id = work->data; + FileData *fd = id->fd; + work = work->next; + + + match = filelist_sort_compare_filedata_full(fd, sel_fd, vf->sort_method, vf->sort_ascend); + + if (match >= 0) + { + vficon_select(vf, id); + break; + } + } + +} + /* *------------------------------------------------------------------- @@ -2062,6 +2088,8 @@ GList *work, *work_fd; IconData *focus_id; GList *new_filelist = NULL; + GList *selected; + gint num_selected = 0; focus_id = VFICON_INFO(vf, focus_id); @@ -2073,6 +2101,8 @@ vf->list = iconlist_sort(vf->list, vf->sort_method, vf->sort_ascend); /* the list might not be sorted if there were renames */ new_filelist = filelist_sort(new_filelist, vf->sort_method, vf->sort_ascend); + selected = vficon_selection_get_list(vf); + /* check for same files from old_list */ work = vf->list; work_fd = new_filelist; @@ -2095,6 +2125,7 @@ /* not changed, go to next */ work = work->next; work_fd = work_fd->next; + if (id->selected & SELECTION_SELECTED) num_selected++; continue; } @@ -2140,6 +2171,14 @@ filelist_free(new_filelist); + if (selected && num_selected == 0) + { + /* all selected files disappeared */ + vficon_select_closest(vf, selected->data); + } + + filelist_free(selected); + vficon_populate(vf, TRUE, keep_position); /* attempt to keep focus on same icon when refreshing */