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
34 #define GQ_COLLECTION_FAIL_MIN 300
35 #define GQ_COLLECTION_FAIL_PERCENT 98
36 #define GQ_COLLECTION_READ_BUFSIZE 4096
38 struct CollectManagerEntry;
40 static void collection_load_thumb_step(CollectionData *cd);
41 static gboolean collection_save_private(CollectionData *cd, const gchar *path);
43 static CollectManagerEntry *collect_manager_get_entry(const gchar *path);
44 static void collect_manager_entry_reset(CollectManagerEntry *entry);
45 static gint collect_manager_process_action(CollectManagerEntry *entry, gchar **path_ptr);
48 static gboolean scan_geometry(gchar *buffer, gint *x, gint *y, gint *w, gint *h)
52 if (sscanf(buffer, "%d %d %d %d", &nx, &ny, &nw, &nh) != 4) return FALSE;
62 static gboolean collection_load_private(CollectionData *cd, const gchar *path, CollectionLoadFlags flags)
64 gchar s_buf[GQ_COLLECTION_READ_BUFSIZE];
67 gboolean limit_failures = TRUE;
68 gboolean success = TRUE;
69 gboolean has_official_header = FALSE;
70 gboolean has_geometry_header = FALSE;
71 gboolean has_gqview_header = FALSE;
72 gboolean need_header = TRUE;
75 gboolean changed = FALSE;
76 CollectManagerEntry *entry = nullptr;
77 guint flush = !!(flags & COLLECTION_LOAD_FLUSH);
78 guint append = !!(flags & COLLECTION_LOAD_APPEND);
79 guint only_geometry = !!(flags & COLLECTION_LOAD_GEOMETRY);
80 gboolean reading_extended_filename = FALSE;
85 collection_load_stop(cd);
88 collect_manager_flush();
90 entry = collect_manager_get_entry(path);
94 g_list_free_full(cd->list, reinterpret_cast<GDestroyNotify>(collection_info_free));
99 if (!path && !cd->path) return FALSE;
101 if (!path) path = cd->path;
103 pathl = path_from_utf8(path);
105 DEBUG_1("collection load: append=%d flush=%d only_geometry=%d path=%s",
106 append, flush, only_geometry, pathl);
109 f = fopen(pathl, "r");
113 log_printf("Failed to open collection file: \"%s\"\n", path);
117 GString *extended_filename_buffer = g_string_new(nullptr);
118 while (fgets(s_buf, sizeof(s_buf), f))
123 if (!reading_extended_filename)
125 /* Skip whitespaces and empty lines */
126 while (*p && g_ascii_isspace(*p)) p++;
127 if (*p == '\n' || *p == '\r') continue;
132 if (!need_header) continue;
133 if (g_ascii_strncasecmp(p, GQ_COLLECTION_MARKER, strlen(GQ_COLLECTION_MARKER)) == 0)
135 /* Looks like an official collection, allow unchecked input.
136 * All this does is allow adding files that may not exist,
137 * which is needed for the collection manager to work.
138 * Also unofficial files abort after too many invalid entries.
140 has_official_header = TRUE;
141 limit_failures = FALSE;
143 else if (strncmp(p, "#geometry:", 10 ) == 0 &&
144 scan_geometry(p + 10, &cd->window_x, &cd->window_y, &cd->window_w, &cd->window_h))
146 has_geometry_header = TRUE;
147 cd->window_read = TRUE;
148 if (only_geometry) break;
150 else if (g_ascii_strncasecmp(p, "#GQview collection", strlen("#GQview collection")) == 0)
152 /* As 2008/04/15 there is no difference between our collection file format
153 * and GQview 2.1.5 collection file format so ignore failures as well. */
154 has_gqview_header = TRUE;
155 limit_failures = FALSE;
157 need_header = (!has_official_header && !has_gqview_header) || !has_geometry_header;
161 if (only_geometry) continue;
165 /** @todo This is not safe! */
166 /* Updated: anything within double quotes is considered a filename */
167 if (!reading_extended_filename)
169 /* not yet reading filename */
170 while (*p && *p != '"') p++;
172 /* start of filename read */
174 while (*p && *p != '"') p++;
177 /* first part of extended filename */
178 g_string_append(extended_filename_buffer, buf);
179 reading_extended_filename = TRUE;
186 while (*p && *p != '"') p++;
189 /* end of extended filename still not found */
190 g_string_append(extended_filename_buffer, buf);
195 /* end of extended filename found */
196 g_string_append_len(extended_filename_buffer, buf, p - buf);
197 reading_extended_filename = FALSE;
201 if (strlen(extended_filename_buffer->str) > 0)
203 buffer2 = g_strdup(extended_filename_buffer->str);
204 g_string_erase(extended_filename_buffer, 0, -1);
209 buffer2 = g_strdup(buf);
217 changed |= collect_manager_process_action(entry, &buffer2);
219 valid = (buffer2[0] == G_DIR_SEPARATOR && collection_add_check(cd, file_data_new_simple(buffer2), FALSE, TRUE));
220 if (!valid) DEBUG_1("collection invalid file: %s", buffer2);
226 if (limit_failures &&
227 fail > GQ_COLLECTION_FAIL_MIN &&
228 fail * 100 / total > GQ_COLLECTION_FAIL_PERCENT)
230 log_printf("%d invalid filenames in unofficial collection file, closing: %s\n", fail, path);
239 g_string_free(extended_filename_buffer, TRUE);
241 DEBUG_1("collection files: total = %d fail = %d official=%d gqview=%d geometry=%d",
242 total, fail, has_official_header, has_gqview_header, has_geometry_header);
245 if (only_geometry) return has_geometry_header;
249 gchar *buf = nullptr;
250 while (collect_manager_process_action(entry, &buf))
252 collection_add_check(cd, file_data_new_group(buf), FALSE, TRUE);
259 cd->list = collection_list_sort(cd->list, cd->sort_method);
261 if (!flush && changed && success)
262 collection_save_private(cd, path);
265 collect_manager_entry_reset(entry);
267 if (!append) cd->changed = FALSE;
272 gboolean collection_load(CollectionData *cd, const gchar *path, CollectionLoadFlags flags)
274 if (collection_load_private(cd, path, static_cast<CollectionLoadFlags>(flags | COLLECTION_LOAD_FLUSH)))
276 layout_recent_add_path(cd->path);
283 static void collection_load_thumb_do(CollectionData *cd)
287 if (!cd->thumb_loader || !g_list_find(cd->list, cd->thumb_info)) return;
289 pixbuf = thumb_loader_get_pixbuf(cd->thumb_loader);
290 collection_info_set_thumb(cd->thumb_info, pixbuf);
291 g_object_unref(pixbuf);
293 if (cd->info_updated_func) cd->info_updated_func(cd, cd->thumb_info, cd->info_updated_data);
296 static void collection_load_thumb_error_cb(ThumbLoader *, gpointer data)
298 auto cd = static_cast<CollectionData *>(data);
300 collection_load_thumb_do(cd);
301 collection_load_thumb_step(cd);
304 static void collection_load_thumb_done_cb(ThumbLoader *, gpointer data)
306 auto cd = static_cast<CollectionData *>(data);
308 collection_load_thumb_do(cd);
309 collection_load_thumb_step(cd);
312 static void collection_load_thumb_step(CollectionData *cd)
319 collection_load_stop(cd);
324 ci = static_cast<CollectInfo *>(work->data);
326 /* find first unloaded thumb */
327 while (work && ci->pixbuf)
329 ci = static_cast<CollectInfo *>(work->data);
333 if (!ci || ci->pixbuf)
336 collection_load_stop(cd);
338 /* send a NULL CollectInfo to notify end */
339 if (cd->info_updated_func) cd->info_updated_func(cd, nullptr, cd->info_updated_data);
344 /* setup loader and call it */
346 thumb_loader_free(cd->thumb_loader);
347 cd->thumb_loader = thumb_loader_new(options->thumbnails.max_width, options->thumbnails.max_height);
348 thumb_loader_set_callbacks(cd->thumb_loader,
349 collection_load_thumb_done_cb,
350 collection_load_thumb_error_cb,
355 if (!thumb_loader_start(cd->thumb_loader, ci->fd))
357 /* error, handle it, do next */
358 DEBUG_1("error loading thumb for %s", ci->fd->path);
359 collection_load_thumb_do(cd);
360 collection_load_thumb_step(cd);
364 void collection_load_thumb_idle(CollectionData *cd)
366 if (!cd->thumb_loader) collection_load_thumb_step(cd);
369 gboolean collection_load_begin(CollectionData *cd, const gchar *path, CollectionLoadFlags flags)
371 if (!collection_load(cd, path, flags)) return FALSE;
373 collection_load_thumb_idle(cd);
378 void collection_load_stop(CollectionData *cd)
380 if (!cd->thumb_loader) return;
382 thumb_loader_free(cd->thumb_loader);
383 cd->thumb_loader = nullptr;
386 static gboolean collection_save_private(CollectionData *cd, const gchar *path)
392 if (!path && !cd->path) return FALSE;
400 pathl = path_from_utf8(path);
401 ssi = secure_open(pathl);
405 log_printf(_("failed to open collection (write) \"%s\"\n"), path);
409 secure_fprintf(ssi, "%s collection\n", GQ_COLLECTION_MARKER);
410 secure_fprintf(ssi, "#created with %s version %s\n", GQ_APPNAME, VERSION);
412 collection_update_geometry(cd);
415 secure_fprintf(ssi, "#geometry: %d %d %d %d\n", cd->window_x, cd->window_y, cd->window_w, cd->window_h);
419 while (work && secsave_errno == SS_ERR_NONE)
421 auto ci = static_cast<CollectInfo *>(work->data);
422 secure_fprintf(ssi, "\"%s\"\n", ci->fd->path);
426 secure_fprintf(ssi, "#end\n");
428 if (secure_close(ssi))
430 log_printf(_("error saving collection file: %s\nerror: %s\n"), path,
431 secsave_strerror(secsave_errno));
435 if (!cd->path || strcmp(path, cd->path) != 0)
437 gchar *buf = cd->path;
438 cd->path = g_strdup(path);
443 cd->name = g_strdup(filename_from_path(cd->path));
445 collection_path_changed(cd);
453 gboolean collection_save(CollectionData *cd, const gchar *path)
455 if (collection_save_private(cd, path))
457 layout_recent_add_path(cd->path);
464 gboolean collection_load_only_geometry(CollectionData *cd, const gchar *path)
466 return collection_load(cd, path, COLLECTION_LOAD_GEOMETRY);
471 *-------------------------------------------------------------------
473 *-------------------------------------------------------------------
476 #define COLLECT_MANAGER_ACTIONS_PER_IDLE 1000
477 #define COLLECT_MANAGER_FLUSH_DELAY 10000
479 struct CollectManagerEntry
483 GHashTable *oldpath_hash;
484 GHashTable *newpath_hash;
488 enum CollectManagerType {
489 COLLECTION_MANAGER_UPDATE,
490 COLLECTION_MANAGER_ADD,
491 COLLECTION_MANAGER_REMOVE
494 struct CollectManagerAction
499 CollectManagerType type;
505 static GList *collection_manager_entry_list = nullptr;
506 static GList *collection_manager_action_list = nullptr;
507 static GList *collection_manager_action_tail = nullptr;
508 static guint collection_manager_timer_id = 0; /* event source id */
511 static CollectManagerAction *collect_manager_action_new(const gchar *oldpath, const gchar *newpath,
512 CollectManagerType type)
514 CollectManagerAction *action;
516 action = g_new0(CollectManagerAction, 1);
519 action->oldpath = g_strdup(oldpath);
520 action->newpath = g_strdup(newpath);
527 static void collect_manager_action_ref(CollectManagerAction *action)
532 static void collect_manager_action_unref(CollectManagerAction *action)
536 if (action->ref > 0) return;
538 g_free(action->oldpath);
539 g_free(action->newpath);
543 static void collect_manager_entry_free_data(CollectManagerEntry *entry)
545 g_list_free_full(entry->add_list, reinterpret_cast<GDestroyNotify>(collect_manager_action_unref));
546 if (g_hash_table_size(entry->oldpath_hash) > 0)
547 g_hash_table_destroy(entry->oldpath_hash);
549 g_hash_table_unref(entry->oldpath_hash);
550 if (g_hash_table_size(entry->newpath_hash) > 0)
551 g_hash_table_destroy(entry->newpath_hash);
553 g_hash_table_unref(entry->newpath_hash);
556 static void collect_manager_entry_init_data(CollectManagerEntry *entry)
558 entry->add_list = nullptr;
559 entry->oldpath_hash = g_hash_table_new_full(g_str_hash, g_str_equal, nullptr, reinterpret_cast<GDestroyNotify>(collect_manager_action_unref));
560 entry->newpath_hash = g_hash_table_new(g_str_hash, g_str_equal);
565 static CollectManagerEntry *collect_manager_entry_new(const gchar *path)
567 CollectManagerEntry *entry;
569 entry = g_new0(CollectManagerEntry, 1);
570 entry->path = g_strdup(path);
571 collect_manager_entry_init_data(entry);
573 collection_manager_entry_list = g_list_append(collection_manager_entry_list, entry);
579 static void collect_manager_entry_free(CollectManagerEntry *entry)
581 collection_manager_entry_list = g_list_remove(collection_manager_entry_list, entry);
583 collect_manager_entry_free_data(entry);
589 static void collect_manager_entry_reset(CollectManagerEntry *entry)
591 collect_manager_entry_free_data(entry);
592 collect_manager_entry_init_data(entry);
595 static CollectManagerEntry *collect_manager_get_entry(const gchar *path)
599 work = collection_manager_entry_list;
602 CollectManagerEntry *entry;
604 entry = static_cast<CollectManagerEntry *>(work->data);
606 if (strcmp(entry->path, path) == 0)
615 static void collect_manager_entry_add_action(CollectManagerEntry *entry, CollectManagerAction *action)
618 CollectManagerAction *orig_action;
620 entry->empty = FALSE;
622 if (action->oldpath == nullptr)
625 if (action->newpath == nullptr)
630 orig_action = static_cast<CollectManagerAction *>(g_hash_table_lookup(entry->newpath_hash, action->newpath));
633 /* target already exists */
634 log_printf("collection manager failed to add another action for target %s in collection %s\n",
635 action->newpath, entry->path);
638 entry->add_list = g_list_append(entry->add_list, action);
639 g_hash_table_insert(entry->newpath_hash, action->newpath, action);
640 collect_manager_action_ref(action);
644 orig_action = static_cast<CollectManagerAction *>(g_hash_table_lookup(entry->newpath_hash, action->oldpath));
647 /* new action with the same file */
648 CollectManagerAction *new_action = collect_manager_action_new(orig_action->oldpath, action->newpath, action->type);
650 if (new_action->oldpath)
652 g_hash_table_steal(entry->oldpath_hash, orig_action->oldpath);
653 g_hash_table_insert(entry->oldpath_hash, new_action->oldpath, new_action);
657 GList *work = g_list_find(entry->add_list, orig_action);
658 work->data = new_action;
661 g_hash_table_steal(entry->newpath_hash, orig_action->newpath);
662 if (new_action->newpath)
664 g_hash_table_insert(entry->newpath_hash, new_action->newpath, new_action);
666 collect_manager_action_unref(orig_action);
671 orig_action = static_cast<CollectManagerAction *>(g_hash_table_lookup(entry->oldpath_hash, action->oldpath));
674 /* another action for the same source, ignore */
675 log_printf("collection manager failed to add another action for source %s in collection %s\n",
676 action->oldpath, entry->path);
680 g_hash_table_insert(entry->oldpath_hash, action->oldpath, action);
683 g_hash_table_insert(entry->newpath_hash, action->newpath, action);
685 collect_manager_action_ref(action);
688 static gboolean collect_manager_process_action(CollectManagerEntry *entry, gchar **path_ptr)
690 gchar *path = *path_ptr;
691 CollectManagerAction *action;
698 action = static_cast<CollectManagerAction *>(entry->add_list->data);
699 g_assert(action->oldpath == nullptr);
700 entry->add_list = g_list_remove(entry->add_list, action);
701 path = g_strdup(action->newpath);
702 g_hash_table_remove(entry->newpath_hash, path);
703 collect_manager_action_unref(action);
706 return (path != nullptr);
709 action = static_cast<CollectManagerAction *>(g_hash_table_lookup(entry->oldpath_hash, path));
713 strcpy(*path_ptr, action->newpath);
717 return FALSE; /* no change */
720 static void collect_manager_refresh()
726 dir_fd = file_data_new_dir(get_collections_dir());
727 filelist_read(dir_fd, &list, nullptr);
728 file_data_unref(dir_fd);
730 work = collection_manager_entry_list;
733 CollectManagerEntry *entry;
736 entry = static_cast<CollectManagerEntry *>(work->data);
740 while (list_step && entry)
744 fd = static_cast<FileData *>(list_step->data);
745 list_step = list_step->next;
747 if (strcmp(fd->path, entry->path) == 0)
749 list = g_list_remove(list, fd);
756 collect_manager_entry_free(entry);
768 fd = static_cast<FileData *>(work->data);
771 collect_manager_entry_new(fd->path);
777 static void collect_manager_process_actions(gint max)
779 if (collection_manager_action_list) DEBUG_1("collection manager processing actions");
781 while (collection_manager_action_list != nullptr && max > 0)
783 CollectManagerAction *action;
786 action = static_cast<CollectManagerAction *>(collection_manager_action_list->data);
787 work = collection_manager_entry_list;
790 CollectManagerEntry *entry;
792 entry = static_cast<CollectManagerEntry *>(work->data);
795 if (action->type == COLLECTION_MANAGER_UPDATE)
797 collect_manager_entry_add_action(entry, action);
799 else if (action->oldpath && action->newpath &&
800 strcmp(action->newpath, entry->path) == 0)
802 /* convert action to standard add format */
803 g_free(action->newpath);
804 if (action->type == COLLECTION_MANAGER_ADD)
806 action->newpath = action->oldpath;
807 action->oldpath = nullptr;
809 else if (action->type == COLLECTION_MANAGER_REMOVE)
811 action->newpath = nullptr;
813 collect_manager_entry_add_action(entry, action);
819 if (action->type != COLLECTION_MANAGER_UPDATE &&
820 action->oldpath && action->newpath)
822 log_printf("collection manager failed to %s %s for collection %s\n",
823 (action->type == COLLECTION_MANAGER_ADD) ? "add" : "remove",
824 action->oldpath, action->newpath);
827 if (collection_manager_action_tail == collection_manager_action_list)
829 collection_manager_action_tail = nullptr;
831 collection_manager_action_list = g_list_remove(collection_manager_action_list, action);
832 collect_manager_action_unref(action);
836 static gboolean collect_manager_process_entry(CollectManagerEntry *entry)
840 if (entry->empty) return FALSE;
842 cd = collection_new(entry->path);
843 (void) collection_load_private(cd, entry->path, COLLECTION_LOAD_NONE);
845 collection_unref(cd);
850 static gboolean collect_manager_process_entry_list()
854 work = collection_manager_entry_list;
857 CollectManagerEntry *entry;
859 entry = static_cast<CollectManagerEntry *>(work->data);
861 if (collect_manager_process_entry(entry)) return TRUE;
869 static gboolean collect_manager_process_cb(gpointer)
871 if (collection_manager_action_list) collect_manager_refresh();
872 collect_manager_process_actions(COLLECT_MANAGER_ACTIONS_PER_IDLE);
873 if (collection_manager_action_list) return G_SOURCE_CONTINUE;
875 if (collect_manager_process_entry_list()) return G_SOURCE_CONTINUE;
877 DEBUG_1("collection manager is up to date");
878 return G_SOURCE_REMOVE;
881 static gboolean collect_manager_timer_cb(gpointer)
883 DEBUG_1("collection manager timer expired");
885 g_idle_add_full(G_PRIORITY_LOW, collect_manager_process_cb, nullptr, nullptr);
887 collection_manager_timer_id = 0;
891 static void collect_manager_timer_push(gint stop)
893 if (collection_manager_timer_id)
897 g_source_remove(collection_manager_timer_id);
898 collection_manager_timer_id = 0;
903 collection_manager_timer_id = g_timeout_add(COLLECT_MANAGER_FLUSH_DELAY,
904 collect_manager_timer_cb, nullptr);
905 DEBUG_1("collection manager timer started");
909 static void collect_manager_add_action(CollectManagerAction *action)
913 /* we keep track of the list's tail to keep this a n(1) operation */
915 if (collection_manager_action_tail)
917 collection_manager_action_tail = g_list_append(collection_manager_action_tail, action);
918 collection_manager_action_tail = collection_manager_action_tail->next;
922 collection_manager_action_list = g_list_append(collection_manager_action_list, action);
923 collection_manager_action_tail = collection_manager_action_list;
926 collect_manager_timer_push(FALSE);
929 void collect_manager_moved(FileData *fd)
931 CollectManagerAction *action;
932 const gchar *oldpath = fd->change->source;
933 const gchar *newpath = fd->change->dest;
935 action = collect_manager_action_new(oldpath, newpath, COLLECTION_MANAGER_UPDATE);
936 collect_manager_add_action(action);
939 void collect_manager_add(FileData *fd, const gchar *collection)
941 CollectManagerAction *action;
944 if (!fd || !collection) return;
946 cw = collection_window_find_by_path(collection);
949 if (collection_list_find_fd(cw->cd->list, fd) == nullptr)
951 collection_add(cw->cd, fd, FALSE);
956 action = collect_manager_action_new(fd->path, collection, COLLECTION_MANAGER_ADD);
957 collect_manager_add_action(action);
960 void collect_manager_remove(FileData *fd, const gchar *collection)
962 CollectManagerAction *action;
965 if (!fd || !collection) return;
967 cw = collection_window_find_by_path(collection);
970 while (collection_remove(cw->cd, fd));
974 action = collect_manager_action_new(fd->path, collection, COLLECTION_MANAGER_REMOVE);
975 collect_manager_add_action(action);
978 void collect_manager_flush()
980 collect_manager_timer_push(TRUE);
982 DEBUG_1("collection manager flushing");
983 while (collect_manager_process_cb(nullptr));
986 void collect_manager_notify_cb(FileData *fd, NotifyType type, gpointer)
988 if (!(type & NOTIFY_CHANGE) || !fd->change) return;
990 DEBUG_1("Notify collect_manager: %s %04x", fd->path, type);
991 switch (fd->change->type)
993 case FILEDATA_CHANGE_MOVE:
994 collect_manager_moved(fd);
996 case FILEDATA_CHANGE_COPY:
998 case FILEDATA_CHANGE_RENAME:
999 collect_manager_moved(fd);
1001 case FILEDATA_CHANGE_DELETE:
1002 case FILEDATA_CHANGE_UNSPECIFIED:
1003 case FILEDATA_CHANGE_WRITE_METADATA:
1008 static gint collection_manager_sort_cb(gconstpointer a, gconstpointer b)
1010 auto char_a = static_cast<const gchar *>(a);
1011 auto char_b = static_cast<const gchar *>(b);
1013 return g_strcmp0(char_a, char_b);
1017 * @brief Creates sorted list of collections
1018 * @param[out] names_exc sorted list of collections names excluding extension
1019 * @param[out] names_inc sorted list of collections names including extension
1020 * @param[out] paths sorted list of collection paths
1022 * Lists of type gchar.
1023 * Used lists must be freed with string_list_free()
1025 void collect_manager_list(GList **names_exc, GList **names_inc, GList **paths)
1028 GList *list = nullptr;
1033 if (names_exc == nullptr && names_inc == nullptr && paths == nullptr)
1038 dir_fd = file_data_new_dir((get_collections_dir()));
1040 filelist_read(dir_fd, &list, nullptr);
1044 fd = static_cast<FileData *>(list->data);
1045 filename = g_strdup(filename_from_path(fd->path));
1047 if (file_extension_match(filename, GQ_COLLECTION_EXT))
1049 name = remove_extension_from_path(filename);
1051 if (names_exc != nullptr)
1053 *names_exc = g_list_insert_sorted(*names_exc, g_strdup(name),
1054 collection_manager_sort_cb);
1055 *names_exc = g_list_first(*names_exc);
1057 if (names_inc != nullptr)
1059 *names_inc = g_list_insert_sorted(*names_inc,filename,
1060 collection_manager_sort_cb);
1061 *names_inc = g_list_first(*names_inc);
1063 if (paths != nullptr)
1065 *paths = g_list_insert_sorted(*paths, g_strdup(fd->path),
1066 collection_manager_sort_cb);
1067 *paths = g_list_first(*paths);
1075 filelist_free(list);
1077 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */