Mercurial > geeqie.yaz
changeset 148:a8b4b99c9359
improved directory scanning a bit
author | nadvornik |
---|---|
date | Thu, 22 Nov 2007 21:15:35 +0000 |
parents | b2266996fa83 |
children | f0c79a514c06 |
files | src/filelist.c |
diffstat | 1 files changed, 21 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/filelist.c Wed Nov 21 22:46:50 2007 +0000 +++ b/src/filelist.c Thu Nov 22 21:15:35 2007 +0000 @@ -1058,6 +1058,24 @@ } +static GList *filelist_filter_out_sidecars(GList *flist) +{ + GList *work = flist; + GList *flist_filtered = NULL; + + while (work) + { + FileData *fd = work->data; + work = work->next; + if (fd->parent) /* remove fd's that are children */ + file_data_unref(fd); + else + flist_filtered = g_list_prepend(flist_filtered, fd); + } + g_list_free(flist); + return flist_filtered; +} + static gint filelist_read_real(const gchar *path, GList **files, GList **dirs, gint follow_symlinks) { DIR *dp; @@ -1112,12 +1130,7 @@ { if ((files) && filter_name_exists(name)) { - FileData *fd = file_data_new_local(filepath, &ent_sbuf, TRUE); - - if (fd->parent) - file_data_unref(fd); - else - flist = g_list_prepend(flist, fd); + flist = g_list_prepend(flist, file_data_new_local(filepath, &ent_sbuf, TRUE)); } } } @@ -1129,6 +1142,8 @@ g_free(pathl); + flist = filelist_filter_out_sidecars(flist); + if (dirs) *dirs = dlist; if (files) *files = flist;