2 * Copyright (C) 2004 John Ellis
3 * Copyright (C) 2008 - 2016 The Geeqie Team
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include "collect-io.h"
27 #include "layout-util.h"
28 #include "secure-save.h"
30 #include "ui-fileops.h"
32 #define GQ_COLLECTION_MARKER "#" GQ_APPNAME
35 GQ_COLLECTION_FAIL_MIN = 300,
36 GQ_COLLECTION_FAIL_PERCENT = 98,
37 GQ_COLLECTION_READ_BUFSIZE = 4096
40 struct CollectManagerEntry;
42 static void collection_load_thumb_step(CollectionData *cd);
43 static gboolean collection_save_private(CollectionData *cd, const gchar *path);
45 static CollectManagerEntry *collect_manager_get_entry(const gchar *path);
46 static void collect_manager_entry_reset(CollectManagerEntry *entry);
47 static gint collect_manager_process_action(CollectManagerEntry *entry, gchar **path_ptr);
52 gboolean scan_geometry(gchar *buffer, GdkRectangle &window)
56 if (sscanf(buffer, "%d %d %d %d", &nx, &ny, &nw, &nh) != 4) return FALSE;
68 static gboolean collection_load_private(CollectionData *cd, const gchar *path, CollectionLoadFlags flags)
70 gchar s_buf[GQ_COLLECTION_READ_BUFSIZE];
73 gboolean limit_failures = TRUE;
74 gboolean success = TRUE;
75 gboolean has_official_header = FALSE;
76 gboolean has_geometry_header = FALSE;
77 gboolean has_gqview_header = FALSE;
78 gboolean need_header = TRUE;
81 gboolean changed = FALSE;
82 CollectManagerEntry *entry = nullptr;
83 guint flush = !!(flags & COLLECTION_LOAD_FLUSH);
84 guint append = !!(flags & COLLECTION_LOAD_APPEND);
85 guint only_geometry = !!(flags & COLLECTION_LOAD_GEOMETRY);
86 gboolean reading_extended_filename = FALSE;
91 collection_load_stop(cd);
94 collect_manager_flush();
96 entry = collect_manager_get_entry(path);
100 g_list_free_full(cd->list, reinterpret_cast<GDestroyNotify>(collection_info_free));
105 if (!path && !cd->path) return FALSE;
107 if (!path) path = cd->path;
109 pathl = path_from_utf8(path);
111 DEBUG_1("collection load: append=%d flush=%d only_geometry=%d path=%s",
112 append, flush, only_geometry, pathl);
115 f = fopen(pathl, "r");
119 log_printf("Failed to open collection file: \"%s\"\n", path);
123 GString *extended_filename_buffer = g_string_new(nullptr);
124 while (fgets(s_buf, sizeof(s_buf), f))
129 if (!reading_extended_filename)
131 /* Skip whitespaces and empty lines */
132 while (*p && g_ascii_isspace(*p)) p++;
133 if (*p == '\n' || *p == '\r') continue;
138 if (!need_header) continue;
139 if (g_ascii_strncasecmp(p, GQ_COLLECTION_MARKER, strlen(GQ_COLLECTION_MARKER)) == 0)
141 /* Looks like an official collection, allow unchecked input.
142 * All this does is allow adding files that may not exist,
143 * which is needed for the collection manager to work.
144 * Also unofficial files abort after too many invalid entries.
146 has_official_header = TRUE;
147 limit_failures = FALSE;
149 else if (strncmp(p, "#geometry:", 10 ) == 0 &&
150 scan_geometry(p + 10, cd->window))
152 has_geometry_header = TRUE;
153 cd->window_read = TRUE;
154 if (only_geometry) break;
156 else if (g_ascii_strncasecmp(p, "#GQview collection", strlen("#GQview collection")) == 0)
158 /* As 2008/04/15 there is no difference between our collection file format
159 * and GQview 2.1.5 collection file format so ignore failures as well. */
160 has_gqview_header = TRUE;
161 limit_failures = FALSE;
163 need_header = (!has_official_header && !has_gqview_header) || !has_geometry_header;
167 if (only_geometry) continue;
171 /** @todo This is not safe! */
172 /* Updated: anything within double quotes is considered a filename */
173 if (!reading_extended_filename)
175 /* not yet reading filename */
176 while (*p && *p != '"') p++;
178 /* start of filename read */
180 while (*p && *p != '"') p++;
183 /* first part of extended filename */
184 g_string_append(extended_filename_buffer, buf);
185 reading_extended_filename = TRUE;
192 while (*p && *p != '"') p++;
195 /* end of extended filename still not found */
196 g_string_append(extended_filename_buffer, buf);
200 /* end of extended filename found */
201 g_string_append_len(extended_filename_buffer, buf, p - buf);
202 reading_extended_filename = FALSE;
205 if (extended_filename_buffer->len > 0)
207 buffer2 = g_strdup(extended_filename_buffer->str);
208 g_string_erase(extended_filename_buffer, 0, -1);
213 buffer2 = g_strdup(buf);
221 changed |= collect_manager_process_action(entry, &buffer2);
223 valid = (buffer2[0] == G_DIR_SEPARATOR && collection_add_check(cd, file_data_new_simple(buffer2), FALSE, TRUE));
224 if (!valid) DEBUG_1("collection invalid file: %s", buffer2);
230 if (limit_failures &&
231 fail > GQ_COLLECTION_FAIL_MIN &&
232 fail * 100 / total > GQ_COLLECTION_FAIL_PERCENT)
234 log_printf("%d invalid filenames in unofficial collection file, closing: %s\n", fail, path);
243 g_string_free(extended_filename_buffer, TRUE);
245 DEBUG_1("collection files: total = %d fail = %d official=%d gqview=%d geometry=%d",
246 total, fail, has_official_header, has_gqview_header, has_geometry_header);
249 if (only_geometry) return has_geometry_header;
253 gchar *buf = nullptr;
254 while (collect_manager_process_action(entry, &buf))
256 collection_add_check(cd, file_data_new_group(buf), FALSE, TRUE);
263 cd->list = collection_list_sort(cd->list, cd->sort_method);
265 if (!flush && changed && success)
266 collection_save_private(cd, path);
269 collect_manager_entry_reset(entry);
271 if (!append) cd->changed = FALSE;
276 gboolean collection_load(CollectionData *cd, const gchar *path, CollectionLoadFlags flags)
278 if (collection_load_private(cd, path, static_cast<CollectionLoadFlags>(flags | COLLECTION_LOAD_FLUSH)))
280 layout_recent_add_path(cd->path);
287 static void collection_load_thumb_do(CollectionData *cd)
291 if (!cd->thumb_loader || !g_list_find(cd->list, cd->thumb_info)) return;
293 pixbuf = thumb_loader_get_pixbuf(cd->thumb_loader);
294 collection_info_set_thumb(cd->thumb_info, pixbuf);
295 g_object_unref(pixbuf);
297 if (cd->info_updated_func) cd->info_updated_func(cd, cd->thumb_info, cd->info_updated_data);
300 static void collection_load_thumb_error_cb(ThumbLoader *, gpointer data)
302 auto cd = static_cast<CollectionData *>(data);
304 collection_load_thumb_do(cd);
305 collection_load_thumb_step(cd);
308 static void collection_load_thumb_done_cb(ThumbLoader *, gpointer data)
310 auto cd = static_cast<CollectionData *>(data);
312 collection_load_thumb_do(cd);
313 collection_load_thumb_step(cd);
316 static void collection_load_thumb_step(CollectionData *cd)
323 collection_load_stop(cd);
328 ci = static_cast<CollectInfo *>(work->data);
330 /* find first unloaded thumb */
331 while (work && ci->pixbuf)
333 ci = static_cast<CollectInfo *>(work->data);
337 if (!ci || ci->pixbuf)
340 collection_load_stop(cd);
342 /* send a NULL CollectInfo to notify end */
343 if (cd->info_updated_func) cd->info_updated_func(cd, nullptr, cd->info_updated_data);
348 /* setup loader and call it */
350 thumb_loader_free(cd->thumb_loader);
351 cd->thumb_loader = thumb_loader_new(options->thumbnails.max_width, options->thumbnails.max_height);
352 thumb_loader_set_callbacks(cd->thumb_loader,
353 collection_load_thumb_done_cb,
354 collection_load_thumb_error_cb,
359 if (!thumb_loader_start(cd->thumb_loader, ci->fd))
361 /* error, handle it, do next */
362 DEBUG_1("error loading thumb for %s", ci->fd->path);
363 collection_load_thumb_do(cd);
364 collection_load_thumb_step(cd);
368 void collection_load_thumb_idle(CollectionData *cd)
370 if (!cd->thumb_loader) collection_load_thumb_step(cd);
373 gboolean collection_load_begin(CollectionData *cd, const gchar *path, CollectionLoadFlags flags)
375 if (!collection_load(cd, path, flags)) return FALSE;
377 collection_load_thumb_idle(cd);
382 void collection_load_stop(CollectionData *cd)
384 if (!cd->thumb_loader) return;
386 thumb_loader_free(cd->thumb_loader);
387 cd->thumb_loader = nullptr;
390 static gboolean collection_save_private(CollectionData *cd, const gchar *path)
396 if (!path && !cd->path) return FALSE;
404 pathl = path_from_utf8(path);
405 ssi = secure_open(pathl);
409 log_printf(_("failed to open collection (write) \"%s\"\n"), path);
413 secure_fprintf(ssi, "%s collection\n", GQ_COLLECTION_MARKER);
414 secure_fprintf(ssi, "#created with %s version %s\n", GQ_APPNAME, VERSION);
416 collection_update_geometry(cd);
419 secure_fprintf(ssi, "#geometry: %d %d %d %d\n", cd->window.x, cd->window.y, cd->window.width, cd->window.height);
423 while (work && secsave_errno == SS_ERR_NONE)
425 auto ci = static_cast<CollectInfo *>(work->data);
426 secure_fprintf(ssi, "\"%s\"\n", ci->fd->path);
430 secure_fprintf(ssi, "#end\n");
432 if (secure_close(ssi))
434 log_printf(_("error saving collection file: %s\nerror: %s\n"), path,
435 secsave_strerror(secsave_errno));
439 if (!cd->path || strcmp(path, cd->path) != 0)
441 gchar *buf = cd->path;
442 cd->path = g_strdup(path);
447 cd->name = g_strdup(filename_from_path(cd->path));
449 collection_path_changed(cd);
457 gboolean collection_save(CollectionData *cd, const gchar *path)
459 if (collection_save_private(cd, path))
461 layout_recent_add_path(cd->path);
468 gboolean collection_load_only_geometry(CollectionData *cd, const gchar *path)
470 return collection_load(cd, path, COLLECTION_LOAD_GEOMETRY);
475 *-------------------------------------------------------------------
477 *-------------------------------------------------------------------
481 COLLECT_MANAGER_ACTIONS_PER_IDLE = 1000,
482 COLLECT_MANAGER_FLUSH_DELAY = 10000
485 struct CollectManagerEntry
489 GHashTable *oldpath_hash;
490 GHashTable *newpath_hash;
494 enum CollectManagerType {
495 COLLECTION_MANAGER_UPDATE,
496 COLLECTION_MANAGER_ADD,
497 COLLECTION_MANAGER_REMOVE
500 struct CollectManagerAction
505 CollectManagerType type;
511 static GList *collection_manager_entry_list = nullptr;
512 static GList *collection_manager_action_list = nullptr;
513 static GList *collection_manager_action_tail = nullptr;
514 static guint collection_manager_timer_id = 0; /* event source id */
517 static CollectManagerAction *collect_manager_action_new(const gchar *oldpath, const gchar *newpath,
518 CollectManagerType type)
520 CollectManagerAction *action;
522 action = g_new0(CollectManagerAction, 1);
525 action->oldpath = g_strdup(oldpath);
526 action->newpath = g_strdup(newpath);
533 static void collect_manager_action_ref(CollectManagerAction *action)
538 static void collect_manager_action_unref(CollectManagerAction *action)
542 if (action->ref > 0) return;
544 g_free(action->oldpath);
545 g_free(action->newpath);
549 static void collect_manager_entry_free_data(CollectManagerEntry *entry)
551 g_list_free_full(entry->add_list, reinterpret_cast<GDestroyNotify>(collect_manager_action_unref));
552 if (g_hash_table_size(entry->oldpath_hash) > 0)
553 g_hash_table_destroy(entry->oldpath_hash);
555 g_hash_table_unref(entry->oldpath_hash);
556 if (g_hash_table_size(entry->newpath_hash) > 0)
557 g_hash_table_destroy(entry->newpath_hash);
559 g_hash_table_unref(entry->newpath_hash);
562 static void collect_manager_entry_init_data(CollectManagerEntry *entry)
564 entry->add_list = nullptr;
565 entry->oldpath_hash = g_hash_table_new_full(g_str_hash, g_str_equal, nullptr, reinterpret_cast<GDestroyNotify>(collect_manager_action_unref));
566 entry->newpath_hash = g_hash_table_new(g_str_hash, g_str_equal);
571 static CollectManagerEntry *collect_manager_entry_new(const gchar *path)
573 CollectManagerEntry *entry;
575 entry = g_new0(CollectManagerEntry, 1);
576 entry->path = g_strdup(path);
577 collect_manager_entry_init_data(entry);
579 collection_manager_entry_list = g_list_append(collection_manager_entry_list, entry);
585 static void collect_manager_entry_free(CollectManagerEntry *entry)
587 collection_manager_entry_list = g_list_remove(collection_manager_entry_list, entry);
589 collect_manager_entry_free_data(entry);
595 static void collect_manager_entry_reset(CollectManagerEntry *entry)
597 collect_manager_entry_free_data(entry);
598 collect_manager_entry_init_data(entry);
601 static CollectManagerEntry *collect_manager_get_entry(const gchar *path)
605 work = collection_manager_entry_list;
608 CollectManagerEntry *entry;
610 entry = static_cast<CollectManagerEntry *>(work->data);
612 if (strcmp(entry->path, path) == 0)
621 static void collect_manager_entry_add_action(CollectManagerEntry *entry, CollectManagerAction *action)
624 CollectManagerAction *orig_action;
626 entry->empty = FALSE;
628 if (action->oldpath == nullptr)
631 if (action->newpath == nullptr)
636 orig_action = static_cast<CollectManagerAction *>(g_hash_table_lookup(entry->newpath_hash, action->newpath));
639 /* target already exists */
640 log_printf("collection manager failed to add another action for target %s in collection %s\n",
641 action->newpath, entry->path);
644 entry->add_list = g_list_append(entry->add_list, action);
645 g_hash_table_insert(entry->newpath_hash, action->newpath, action);
646 collect_manager_action_ref(action);
650 orig_action = static_cast<CollectManagerAction *>(g_hash_table_lookup(entry->newpath_hash, action->oldpath));
653 /* new action with the same file */
654 CollectManagerAction *new_action = collect_manager_action_new(orig_action->oldpath, action->newpath, action->type);
656 if (new_action->oldpath)
658 g_hash_table_steal(entry->oldpath_hash, orig_action->oldpath);
659 g_hash_table_insert(entry->oldpath_hash, new_action->oldpath, new_action);
663 GList *work = g_list_find(entry->add_list, orig_action);
664 work->data = new_action;
667 g_hash_table_steal(entry->newpath_hash, orig_action->newpath);
668 if (new_action->newpath)
670 g_hash_table_insert(entry->newpath_hash, new_action->newpath, new_action);
672 collect_manager_action_unref(orig_action);
677 orig_action = static_cast<CollectManagerAction *>(g_hash_table_lookup(entry->oldpath_hash, action->oldpath));
680 /* another action for the same source, ignore */
681 log_printf("collection manager failed to add another action for source %s in collection %s\n",
682 action->oldpath, entry->path);
686 g_hash_table_insert(entry->oldpath_hash, action->oldpath, action);
689 g_hash_table_insert(entry->newpath_hash, action->newpath, action);
691 collect_manager_action_ref(action);
694 static gboolean collect_manager_process_action(CollectManagerEntry *entry, gchar **path_ptr)
696 gchar *path = *path_ptr;
697 CollectManagerAction *action;
704 action = static_cast<CollectManagerAction *>(entry->add_list->data);
705 g_assert(action->oldpath == nullptr);
706 entry->add_list = g_list_remove(entry->add_list, action);
707 path = g_strdup(action->newpath);
708 g_hash_table_remove(entry->newpath_hash, path);
709 collect_manager_action_unref(action);
712 return (path != nullptr);
715 action = static_cast<CollectManagerAction *>(g_hash_table_lookup(entry->oldpath_hash, path));
719 strcpy(*path_ptr, action->newpath);
723 return FALSE; /* no change */
726 static void collect_manager_refresh()
732 dir_fd = file_data_new_dir(get_collections_dir());
733 filelist_read(dir_fd, &list, nullptr);
734 file_data_unref(dir_fd);
736 work = collection_manager_entry_list;
739 CollectManagerEntry *entry;
742 entry = static_cast<CollectManagerEntry *>(work->data);
746 while (list_step && entry)
750 fd = static_cast<FileData *>(list_step->data);
751 list_step = list_step->next;
753 if (strcmp(fd->path, entry->path) == 0)
755 list = g_list_remove(list, fd);
762 collect_manager_entry_free(entry);
774 fd = static_cast<FileData *>(work->data);
777 collect_manager_entry_new(fd->path);
783 static void collect_manager_process_actions(gint max)
785 if (collection_manager_action_list) DEBUG_1("collection manager processing actions");
787 while (collection_manager_action_list != nullptr && max > 0)
789 CollectManagerAction *action;
792 action = static_cast<CollectManagerAction *>(collection_manager_action_list->data);
793 work = collection_manager_entry_list;
796 CollectManagerEntry *entry;
798 entry = static_cast<CollectManagerEntry *>(work->data);
801 if (action->type == COLLECTION_MANAGER_UPDATE)
803 collect_manager_entry_add_action(entry, action);
805 else if (action->oldpath && action->newpath &&
806 strcmp(action->newpath, entry->path) == 0)
808 /* convert action to standard add format */
809 g_free(action->newpath);
810 if (action->type == COLLECTION_MANAGER_ADD)
812 action->newpath = action->oldpath;
813 action->oldpath = nullptr;
815 else if (action->type == COLLECTION_MANAGER_REMOVE)
817 action->newpath = nullptr;
819 collect_manager_entry_add_action(entry, action);
825 if (action->type != COLLECTION_MANAGER_UPDATE &&
826 action->oldpath && action->newpath)
828 log_printf("collection manager failed to %s %s for collection %s\n",
829 (action->type == COLLECTION_MANAGER_ADD) ? "add" : "remove",
830 action->oldpath, action->newpath);
833 if (collection_manager_action_tail == collection_manager_action_list)
835 collection_manager_action_tail = nullptr;
837 collection_manager_action_list = g_list_remove(collection_manager_action_list, action);
838 collect_manager_action_unref(action);
842 static gboolean collect_manager_process_entry(CollectManagerEntry *entry)
846 if (entry->empty) return FALSE;
848 cd = collection_new(entry->path);
849 (void) collection_load_private(cd, entry->path, COLLECTION_LOAD_NONE);
851 collection_unref(cd);
856 static gboolean collect_manager_process_entry_list()
860 work = collection_manager_entry_list;
863 CollectManagerEntry *entry;
865 entry = static_cast<CollectManagerEntry *>(work->data);
867 if (collect_manager_process_entry(entry)) return TRUE;
875 static gboolean collect_manager_process_cb(gpointer)
877 if (collection_manager_action_list) collect_manager_refresh();
878 collect_manager_process_actions(COLLECT_MANAGER_ACTIONS_PER_IDLE);
879 if (collection_manager_action_list) return G_SOURCE_CONTINUE;
881 if (collect_manager_process_entry_list()) return G_SOURCE_CONTINUE;
883 DEBUG_1("collection manager is up to date");
884 return G_SOURCE_REMOVE;
887 static gboolean collect_manager_timer_cb(gpointer)
889 DEBUG_1("collection manager timer expired");
891 g_idle_add_full(G_PRIORITY_LOW, collect_manager_process_cb, nullptr, nullptr);
893 collection_manager_timer_id = 0;
897 static void collect_manager_timer_push(gint stop)
899 if (collection_manager_timer_id)
903 g_source_remove(collection_manager_timer_id);
904 collection_manager_timer_id = 0;
909 collection_manager_timer_id = g_timeout_add(COLLECT_MANAGER_FLUSH_DELAY,
910 collect_manager_timer_cb, nullptr);
911 DEBUG_1("collection manager timer started");
915 static void collect_manager_add_action(CollectManagerAction *action)
919 /* we keep track of the list's tail to keep this a n(1) operation */
921 if (collection_manager_action_tail)
923 collection_manager_action_tail = g_list_append(collection_manager_action_tail, action);
924 collection_manager_action_tail = collection_manager_action_tail->next;
928 collection_manager_action_list = g_list_append(collection_manager_action_list, action);
929 collection_manager_action_tail = collection_manager_action_list;
932 collect_manager_timer_push(FALSE);
935 void collect_manager_moved(FileData *fd)
937 CollectManagerAction *action;
938 const gchar *oldpath = fd->change->source;
939 const gchar *newpath = fd->change->dest;
941 action = collect_manager_action_new(oldpath, newpath, COLLECTION_MANAGER_UPDATE);
942 collect_manager_add_action(action);
945 void collect_manager_add(FileData *fd, const gchar *collection)
947 CollectManagerAction *action;
950 if (!fd || !collection) return;
952 cw = collection_window_find_by_path(collection);
955 if (collection_list_find_fd(cw->cd->list, fd) == nullptr)
957 collection_add(cw->cd, fd, FALSE);
962 action = collect_manager_action_new(fd->path, collection, COLLECTION_MANAGER_ADD);
963 collect_manager_add_action(action);
966 void collect_manager_remove(FileData *fd, const gchar *collection)
968 CollectManagerAction *action;
971 if (!fd || !collection) return;
973 cw = collection_window_find_by_path(collection);
976 while (collection_remove(cw->cd, fd));
980 action = collect_manager_action_new(fd->path, collection, COLLECTION_MANAGER_REMOVE);
981 collect_manager_add_action(action);
984 void collect_manager_flush()
986 collect_manager_timer_push(TRUE);
988 DEBUG_1("collection manager flushing");
989 while (collect_manager_process_cb(nullptr));
992 void collect_manager_notify_cb(FileData *fd, NotifyType type, gpointer)
994 if (!(type & NOTIFY_CHANGE) || !fd->change) return;
996 DEBUG_1("Notify collect_manager: %s %04x", fd->path, type);
997 switch (fd->change->type)
999 case FILEDATA_CHANGE_MOVE:
1000 collect_manager_moved(fd);
1002 case FILEDATA_CHANGE_COPY:
1004 case FILEDATA_CHANGE_RENAME:
1005 collect_manager_moved(fd);
1007 case FILEDATA_CHANGE_DELETE:
1008 case FILEDATA_CHANGE_UNSPECIFIED:
1009 case FILEDATA_CHANGE_WRITE_METADATA:
1014 static gint collection_manager_sort_cb(gconstpointer a, gconstpointer b)
1016 auto char_a = static_cast<const gchar *>(a);
1017 auto char_b = static_cast<const gchar *>(b);
1019 return g_strcmp0(char_a, char_b);
1023 * @brief Creates sorted list of collections
1024 * @param[out] names_exc sorted list of collections names excluding extension
1025 * @param[out] names_inc sorted list of collections names including extension
1026 * @param[out] paths sorted list of collection paths
1028 * Lists of type gchar.
1029 * Used lists must be freed with string_list_free()
1031 void collect_manager_list(GList **names_exc, GList **names_inc, GList **paths)
1034 GList *list = nullptr;
1039 if (names_exc == nullptr && names_inc == nullptr && paths == nullptr)
1044 dir_fd = file_data_new_dir((get_collections_dir()));
1046 filelist_read(dir_fd, &list, nullptr);
1050 fd = static_cast<FileData *>(list->data);
1051 filename = g_strdup(filename_from_path(fd->path));
1053 if (file_extension_match(filename, GQ_COLLECTION_EXT))
1055 name = remove_extension_from_path(filename);
1057 if (names_exc != nullptr)
1059 *names_exc = g_list_insert_sorted(*names_exc, g_strdup(name),
1060 collection_manager_sort_cb);
1061 *names_exc = g_list_first(*names_exc);
1063 if (names_inc != nullptr)
1065 *names_inc = g_list_insert_sorted(*names_inc,filename,
1066 collection_manager_sort_cb);
1067 *names_inc = g_list_first(*names_inc);
1069 if (paths != nullptr)
1071 *paths = g_list_insert_sorted(*paths, g_strdup(fd->path),
1072 collection_manager_sort_cb);
1073 *paths = g_list_first(*paths);
1081 filelist_free(list);
1083 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */