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);
50 gboolean scan_geometry(gchar *buffer, GdkRectangle &window)
54 if (sscanf(buffer, "%d %d %d %d", &nx, &ny, &nw, &nh) != 4) return FALSE;
66 static gboolean collection_load_private(CollectionData *cd, const gchar *path, CollectionLoadFlags flags)
68 gchar s_buf[GQ_COLLECTION_READ_BUFSIZE];
71 gboolean limit_failures = TRUE;
72 gboolean success = TRUE;
73 gboolean has_official_header = FALSE;
74 gboolean has_geometry_header = FALSE;
75 gboolean has_gqview_header = FALSE;
76 gboolean need_header = TRUE;
79 gboolean changed = FALSE;
80 CollectManagerEntry *entry = nullptr;
81 guint flush = !!(flags & COLLECTION_LOAD_FLUSH);
82 guint append = !!(flags & COLLECTION_LOAD_APPEND);
83 guint only_geometry = !!(flags & COLLECTION_LOAD_GEOMETRY);
84 gboolean reading_extended_filename = FALSE;
89 collection_load_stop(cd);
92 collect_manager_flush();
94 entry = collect_manager_get_entry(path);
98 g_list_free_full(cd->list, reinterpret_cast<GDestroyNotify>(collection_info_free));
103 if (!path && !cd->path) return FALSE;
105 if (!path) path = cd->path;
107 pathl = path_from_utf8(path);
109 DEBUG_1("collection load: append=%d flush=%d only_geometry=%d path=%s",
110 append, flush, only_geometry, pathl);
113 f = fopen(pathl, "r");
117 log_printf("Failed to open collection file: \"%s\"\n", path);
121 GString *extended_filename_buffer = g_string_new(nullptr);
122 while (fgets(s_buf, sizeof(s_buf), f))
127 if (!reading_extended_filename)
129 /* Skip whitespaces and empty lines */
130 while (*p && g_ascii_isspace(*p)) p++;
131 if (*p == '\n' || *p == '\r') continue;
136 if (!need_header) continue;
137 if (g_ascii_strncasecmp(p, GQ_COLLECTION_MARKER, strlen(GQ_COLLECTION_MARKER)) == 0)
139 /* Looks like an official collection, allow unchecked input.
140 * All this does is allow adding files that may not exist,
141 * which is needed for the collection manager to work.
142 * Also unofficial files abort after too many invalid entries.
144 has_official_header = TRUE;
145 limit_failures = FALSE;
147 else if (strncmp(p, "#geometry:", 10 ) == 0 &&
148 scan_geometry(p + 10, cd->window))
150 has_geometry_header = TRUE;
151 cd->window_read = TRUE;
152 if (only_geometry) break;
154 else if (g_ascii_strncasecmp(p, "#GQview collection", strlen("#GQview collection")) == 0)
156 /* As 2008/04/15 there is no difference between our collection file format
157 * and GQview 2.1.5 collection file format so ignore failures as well. */
158 has_gqview_header = TRUE;
159 limit_failures = FALSE;
161 need_header = (!has_official_header && !has_gqview_header) || !has_geometry_header;
165 if (only_geometry) continue;
169 /** @todo This is not safe! */
170 /* Updated: anything within double quotes is considered a filename */
171 if (!reading_extended_filename)
173 /* not yet reading filename */
174 while (*p && *p != '"') p++;
176 /* start of filename read */
178 while (*p && *p != '"') p++;
181 /* first part of extended filename */
182 g_string_append(extended_filename_buffer, buf);
183 reading_extended_filename = TRUE;
190 while (*p && *p != '"') p++;
193 /* end of extended filename still not found */
194 g_string_append(extended_filename_buffer, buf);
198 /* end of extended filename found */
199 g_string_append_len(extended_filename_buffer, buf, p - buf);
200 reading_extended_filename = FALSE;
203 if (extended_filename_buffer->len > 0)
205 buffer2 = g_strdup(extended_filename_buffer->str);
206 g_string_erase(extended_filename_buffer, 0, -1);
211 buffer2 = g_strdup(buf);
219 changed |= collect_manager_process_action(entry, &buffer2);
221 valid = (buffer2[0] == G_DIR_SEPARATOR && collection_add_check(cd, file_data_new_simple(buffer2), FALSE, TRUE));
222 if (!valid) DEBUG_1("collection invalid file: %s", buffer2);
228 if (limit_failures &&
229 fail > GQ_COLLECTION_FAIL_MIN &&
230 fail * 100 / total > GQ_COLLECTION_FAIL_PERCENT)
232 log_printf("%d invalid filenames in unofficial collection file, closing: %s\n", fail, path);
241 g_string_free(extended_filename_buffer, TRUE);
243 DEBUG_1("collection files: total = %d fail = %d official=%d gqview=%d geometry=%d",
244 total, fail, has_official_header, has_gqview_header, has_geometry_header);
247 if (only_geometry) return has_geometry_header;
251 gchar *buf = nullptr;
252 while (collect_manager_process_action(entry, &buf))
254 collection_add_check(cd, file_data_new_group(buf), FALSE, TRUE);
261 cd->list = collection_list_sort(cd->list, cd->sort_method);
263 if (!flush && changed && success)
264 collection_save_private(cd, path);
267 collect_manager_entry_reset(entry);
269 if (!append) cd->changed = FALSE;
274 gboolean collection_load(CollectionData *cd, const gchar *path, CollectionLoadFlags flags)
276 if (collection_load_private(cd, path, static_cast<CollectionLoadFlags>(flags | COLLECTION_LOAD_FLUSH)))
278 layout_recent_add_path(cd->path);
285 static void collection_load_thumb_do(CollectionData *cd)
289 if (!cd->thumb_loader || !g_list_find(cd->list, cd->thumb_info)) return;
291 pixbuf = thumb_loader_get_pixbuf(cd->thumb_loader);
292 collection_info_set_thumb(cd->thumb_info, pixbuf);
293 g_object_unref(pixbuf);
295 if (cd->info_updated_func) cd->info_updated_func(cd, cd->thumb_info, cd->info_updated_data);
298 static void collection_load_thumb_error_cb(ThumbLoader *, gpointer data)
300 auto cd = static_cast<CollectionData *>(data);
302 collection_load_thumb_do(cd);
303 collection_load_thumb_step(cd);
306 static void collection_load_thumb_done_cb(ThumbLoader *, gpointer data)
308 auto cd = static_cast<CollectionData *>(data);
310 collection_load_thumb_do(cd);
311 collection_load_thumb_step(cd);
314 static void collection_load_thumb_step(CollectionData *cd)
321 collection_load_stop(cd);
326 ci = static_cast<CollectInfo *>(work->data);
328 /* find first unloaded thumb */
329 while (work && ci->pixbuf)
331 ci = static_cast<CollectInfo *>(work->data);
335 if (!ci || ci->pixbuf)
338 collection_load_stop(cd);
340 /* send a NULL CollectInfo to notify end */
341 if (cd->info_updated_func) cd->info_updated_func(cd, nullptr, cd->info_updated_data);
346 /* setup loader and call it */
348 thumb_loader_free(cd->thumb_loader);
349 cd->thumb_loader = thumb_loader_new(options->thumbnails.max_width, options->thumbnails.max_height);
350 thumb_loader_set_callbacks(cd->thumb_loader,
351 collection_load_thumb_done_cb,
352 collection_load_thumb_error_cb,
357 if (!thumb_loader_start(cd->thumb_loader, ci->fd))
359 /* error, handle it, do next */
360 DEBUG_1("error loading thumb for %s", ci->fd->path);
361 collection_load_thumb_do(cd);
362 collection_load_thumb_step(cd);
366 void collection_load_thumb_idle(CollectionData *cd)
368 if (!cd->thumb_loader) collection_load_thumb_step(cd);
371 gboolean collection_load_begin(CollectionData *cd, const gchar *path, CollectionLoadFlags flags)
373 if (!collection_load(cd, path, flags)) return FALSE;
375 collection_load_thumb_idle(cd);
380 void collection_load_stop(CollectionData *cd)
382 if (!cd->thumb_loader) return;
384 thumb_loader_free(cd->thumb_loader);
385 cd->thumb_loader = nullptr;
388 static gboolean collection_save_private(CollectionData *cd, const gchar *path)
394 if (!path && !cd->path) return FALSE;
402 pathl = path_from_utf8(path);
403 ssi = secure_open(pathl);
407 log_printf(_("failed to open collection (write) \"%s\"\n"), path);
411 secure_fprintf(ssi, "%s collection\n", GQ_COLLECTION_MARKER);
412 secure_fprintf(ssi, "#created with %s version %s\n", GQ_APPNAME, VERSION);
414 collection_update_geometry(cd);
417 secure_fprintf(ssi, "#geometry: %d %d %d %d\n", cd->window.x, cd->window.y, cd->window.width, cd->window.height);
421 while (work && secsave_errno == SS_ERR_NONE)
423 auto ci = static_cast<CollectInfo *>(work->data);
424 secure_fprintf(ssi, "\"%s\"\n", ci->fd->path);
428 secure_fprintf(ssi, "#end\n");
430 if (secure_close(ssi))
432 log_printf(_("error saving collection file: %s\nerror: %s\n"), path,
433 secsave_strerror(secsave_errno));
437 if (!cd->path || strcmp(path, cd->path) != 0)
439 gchar *buf = cd->path;
440 cd->path = g_strdup(path);
445 cd->name = g_strdup(filename_from_path(cd->path));
447 collection_path_changed(cd);
455 gboolean collection_save(CollectionData *cd, const gchar *path)
457 if (collection_save_private(cd, path))
459 layout_recent_add_path(cd->path);
466 gboolean collection_load_only_geometry(CollectionData *cd, const gchar *path)
468 return collection_load(cd, path, COLLECTION_LOAD_GEOMETRY);
473 *-------------------------------------------------------------------
475 *-------------------------------------------------------------------
478 #define COLLECT_MANAGER_ACTIONS_PER_IDLE 1000
479 #define COLLECT_MANAGER_FLUSH_DELAY 10000
481 struct CollectManagerEntry
485 GHashTable *oldpath_hash;
486 GHashTable *newpath_hash;
490 enum CollectManagerType {
491 COLLECTION_MANAGER_UPDATE,
492 COLLECTION_MANAGER_ADD,
493 COLLECTION_MANAGER_REMOVE
496 struct CollectManagerAction
501 CollectManagerType type;
507 static GList *collection_manager_entry_list = nullptr;
508 static GList *collection_manager_action_list = nullptr;
509 static GList *collection_manager_action_tail = nullptr;
510 static guint collection_manager_timer_id = 0; /* event source id */
513 static CollectManagerAction *collect_manager_action_new(const gchar *oldpath, const gchar *newpath,
514 CollectManagerType type)
516 CollectManagerAction *action;
518 action = g_new0(CollectManagerAction, 1);
521 action->oldpath = g_strdup(oldpath);
522 action->newpath = g_strdup(newpath);
529 static void collect_manager_action_ref(CollectManagerAction *action)
534 static void collect_manager_action_unref(CollectManagerAction *action)
538 if (action->ref > 0) return;
540 g_free(action->oldpath);
541 g_free(action->newpath);
545 static void collect_manager_entry_free_data(CollectManagerEntry *entry)
547 g_list_free_full(entry->add_list, reinterpret_cast<GDestroyNotify>(collect_manager_action_unref));
548 if (g_hash_table_size(entry->oldpath_hash) > 0)
549 g_hash_table_destroy(entry->oldpath_hash);
551 g_hash_table_unref(entry->oldpath_hash);
552 if (g_hash_table_size(entry->newpath_hash) > 0)
553 g_hash_table_destroy(entry->newpath_hash);
555 g_hash_table_unref(entry->newpath_hash);
558 static void collect_manager_entry_init_data(CollectManagerEntry *entry)
560 entry->add_list = nullptr;
561 entry->oldpath_hash = g_hash_table_new_full(g_str_hash, g_str_equal, nullptr, reinterpret_cast<GDestroyNotify>(collect_manager_action_unref));
562 entry->newpath_hash = g_hash_table_new(g_str_hash, g_str_equal);
567 static CollectManagerEntry *collect_manager_entry_new(const gchar *path)
569 CollectManagerEntry *entry;
571 entry = g_new0(CollectManagerEntry, 1);
572 entry->path = g_strdup(path);
573 collect_manager_entry_init_data(entry);
575 collection_manager_entry_list = g_list_append(collection_manager_entry_list, entry);
581 static void collect_manager_entry_free(CollectManagerEntry *entry)
583 collection_manager_entry_list = g_list_remove(collection_manager_entry_list, entry);
585 collect_manager_entry_free_data(entry);
591 static void collect_manager_entry_reset(CollectManagerEntry *entry)
593 collect_manager_entry_free_data(entry);
594 collect_manager_entry_init_data(entry);
597 static CollectManagerEntry *collect_manager_get_entry(const gchar *path)
601 work = collection_manager_entry_list;
604 CollectManagerEntry *entry;
606 entry = static_cast<CollectManagerEntry *>(work->data);
608 if (strcmp(entry->path, path) == 0)
617 static void collect_manager_entry_add_action(CollectManagerEntry *entry, CollectManagerAction *action)
620 CollectManagerAction *orig_action;
622 entry->empty = FALSE;
624 if (action->oldpath == nullptr)
627 if (action->newpath == nullptr)
632 orig_action = static_cast<CollectManagerAction *>(g_hash_table_lookup(entry->newpath_hash, action->newpath));
635 /* target already exists */
636 log_printf("collection manager failed to add another action for target %s in collection %s\n",
637 action->newpath, entry->path);
640 entry->add_list = g_list_append(entry->add_list, action);
641 g_hash_table_insert(entry->newpath_hash, action->newpath, action);
642 collect_manager_action_ref(action);
646 orig_action = static_cast<CollectManagerAction *>(g_hash_table_lookup(entry->newpath_hash, action->oldpath));
649 /* new action with the same file */
650 CollectManagerAction *new_action = collect_manager_action_new(orig_action->oldpath, action->newpath, action->type);
652 if (new_action->oldpath)
654 g_hash_table_steal(entry->oldpath_hash, orig_action->oldpath);
655 g_hash_table_insert(entry->oldpath_hash, new_action->oldpath, new_action);
659 GList *work = g_list_find(entry->add_list, orig_action);
660 work->data = new_action;
663 g_hash_table_steal(entry->newpath_hash, orig_action->newpath);
664 if (new_action->newpath)
666 g_hash_table_insert(entry->newpath_hash, new_action->newpath, new_action);
668 collect_manager_action_unref(orig_action);
673 orig_action = static_cast<CollectManagerAction *>(g_hash_table_lookup(entry->oldpath_hash, action->oldpath));
676 /* another action for the same source, ignore */
677 log_printf("collection manager failed to add another action for source %s in collection %s\n",
678 action->oldpath, entry->path);
682 g_hash_table_insert(entry->oldpath_hash, action->oldpath, action);
685 g_hash_table_insert(entry->newpath_hash, action->newpath, action);
687 collect_manager_action_ref(action);
690 static gboolean collect_manager_process_action(CollectManagerEntry *entry, gchar **path_ptr)
692 gchar *path = *path_ptr;
693 CollectManagerAction *action;
700 action = static_cast<CollectManagerAction *>(entry->add_list->data);
701 g_assert(action->oldpath == nullptr);
702 entry->add_list = g_list_remove(entry->add_list, action);
703 path = g_strdup(action->newpath);
704 g_hash_table_remove(entry->newpath_hash, path);
705 collect_manager_action_unref(action);
708 return (path != nullptr);
711 action = static_cast<CollectManagerAction *>(g_hash_table_lookup(entry->oldpath_hash, path));
715 strcpy(*path_ptr, action->newpath);
719 return FALSE; /* no change */
722 static void collect_manager_refresh()
728 dir_fd = file_data_new_dir(get_collections_dir());
729 filelist_read(dir_fd, &list, nullptr);
730 file_data_unref(dir_fd);
732 work = collection_manager_entry_list;
735 CollectManagerEntry *entry;
738 entry = static_cast<CollectManagerEntry *>(work->data);
742 while (list_step && entry)
746 fd = static_cast<FileData *>(list_step->data);
747 list_step = list_step->next;
749 if (strcmp(fd->path, entry->path) == 0)
751 list = g_list_remove(list, fd);
758 collect_manager_entry_free(entry);
770 fd = static_cast<FileData *>(work->data);
773 collect_manager_entry_new(fd->path);
779 static void collect_manager_process_actions(gint max)
781 if (collection_manager_action_list) DEBUG_1("collection manager processing actions");
783 while (collection_manager_action_list != nullptr && max > 0)
785 CollectManagerAction *action;
788 action = static_cast<CollectManagerAction *>(collection_manager_action_list->data);
789 work = collection_manager_entry_list;
792 CollectManagerEntry *entry;
794 entry = static_cast<CollectManagerEntry *>(work->data);
797 if (action->type == COLLECTION_MANAGER_UPDATE)
799 collect_manager_entry_add_action(entry, action);
801 else if (action->oldpath && action->newpath &&
802 strcmp(action->newpath, entry->path) == 0)
804 /* convert action to standard add format */
805 g_free(action->newpath);
806 if (action->type == COLLECTION_MANAGER_ADD)
808 action->newpath = action->oldpath;
809 action->oldpath = nullptr;
811 else if (action->type == COLLECTION_MANAGER_REMOVE)
813 action->newpath = nullptr;
815 collect_manager_entry_add_action(entry, action);
821 if (action->type != COLLECTION_MANAGER_UPDATE &&
822 action->oldpath && action->newpath)
824 log_printf("collection manager failed to %s %s for collection %s\n",
825 (action->type == COLLECTION_MANAGER_ADD) ? "add" : "remove",
826 action->oldpath, action->newpath);
829 if (collection_manager_action_tail == collection_manager_action_list)
831 collection_manager_action_tail = nullptr;
833 collection_manager_action_list = g_list_remove(collection_manager_action_list, action);
834 collect_manager_action_unref(action);
838 static gboolean collect_manager_process_entry(CollectManagerEntry *entry)
842 if (entry->empty) return FALSE;
844 cd = collection_new(entry->path);
845 (void) collection_load_private(cd, entry->path, COLLECTION_LOAD_NONE);
847 collection_unref(cd);
852 static gboolean collect_manager_process_entry_list()
856 work = collection_manager_entry_list;
859 CollectManagerEntry *entry;
861 entry = static_cast<CollectManagerEntry *>(work->data);
863 if (collect_manager_process_entry(entry)) return TRUE;
871 static gboolean collect_manager_process_cb(gpointer)
873 if (collection_manager_action_list) collect_manager_refresh();
874 collect_manager_process_actions(COLLECT_MANAGER_ACTIONS_PER_IDLE);
875 if (collection_manager_action_list) return G_SOURCE_CONTINUE;
877 if (collect_manager_process_entry_list()) return G_SOURCE_CONTINUE;
879 DEBUG_1("collection manager is up to date");
880 return G_SOURCE_REMOVE;
883 static gboolean collect_manager_timer_cb(gpointer)
885 DEBUG_1("collection manager timer expired");
887 g_idle_add_full(G_PRIORITY_LOW, collect_manager_process_cb, nullptr, nullptr);
889 collection_manager_timer_id = 0;
893 static void collect_manager_timer_push(gint stop)
895 if (collection_manager_timer_id)
899 g_source_remove(collection_manager_timer_id);
900 collection_manager_timer_id = 0;
905 collection_manager_timer_id = g_timeout_add(COLLECT_MANAGER_FLUSH_DELAY,
906 collect_manager_timer_cb, nullptr);
907 DEBUG_1("collection manager timer started");
911 static void collect_manager_add_action(CollectManagerAction *action)
915 /* we keep track of the list's tail to keep this a n(1) operation */
917 if (collection_manager_action_tail)
919 collection_manager_action_tail = g_list_append(collection_manager_action_tail, action);
920 collection_manager_action_tail = collection_manager_action_tail->next;
924 collection_manager_action_list = g_list_append(collection_manager_action_list, action);
925 collection_manager_action_tail = collection_manager_action_list;
928 collect_manager_timer_push(FALSE);
931 void collect_manager_moved(FileData *fd)
933 CollectManagerAction *action;
934 const gchar *oldpath = fd->change->source;
935 const gchar *newpath = fd->change->dest;
937 action = collect_manager_action_new(oldpath, newpath, COLLECTION_MANAGER_UPDATE);
938 collect_manager_add_action(action);
941 void collect_manager_add(FileData *fd, const gchar *collection)
943 CollectManagerAction *action;
946 if (!fd || !collection) return;
948 cw = collection_window_find_by_path(collection);
951 if (collection_list_find_fd(cw->cd->list, fd) == nullptr)
953 collection_add(cw->cd, fd, FALSE);
958 action = collect_manager_action_new(fd->path, collection, COLLECTION_MANAGER_ADD);
959 collect_manager_add_action(action);
962 void collect_manager_remove(FileData *fd, const gchar *collection)
964 CollectManagerAction *action;
967 if (!fd || !collection) return;
969 cw = collection_window_find_by_path(collection);
972 while (collection_remove(cw->cd, fd));
976 action = collect_manager_action_new(fd->path, collection, COLLECTION_MANAGER_REMOVE);
977 collect_manager_add_action(action);
980 void collect_manager_flush()
982 collect_manager_timer_push(TRUE);
984 DEBUG_1("collection manager flushing");
985 while (collect_manager_process_cb(nullptr));
988 void collect_manager_notify_cb(FileData *fd, NotifyType type, gpointer)
990 if (!(type & NOTIFY_CHANGE) || !fd->change) return;
992 DEBUG_1("Notify collect_manager: %s %04x", fd->path, type);
993 switch (fd->change->type)
995 case FILEDATA_CHANGE_MOVE:
996 collect_manager_moved(fd);
998 case FILEDATA_CHANGE_COPY:
1000 case FILEDATA_CHANGE_RENAME:
1001 collect_manager_moved(fd);
1003 case FILEDATA_CHANGE_DELETE:
1004 case FILEDATA_CHANGE_UNSPECIFIED:
1005 case FILEDATA_CHANGE_WRITE_METADATA:
1010 static gint collection_manager_sort_cb(gconstpointer a, gconstpointer b)
1012 auto char_a = static_cast<const gchar *>(a);
1013 auto char_b = static_cast<const gchar *>(b);
1015 return g_strcmp0(char_a, char_b);
1019 * @brief Creates sorted list of collections
1020 * @param[out] names_exc sorted list of collections names excluding extension
1021 * @param[out] names_inc sorted list of collections names including extension
1022 * @param[out] paths sorted list of collection paths
1024 * Lists of type gchar.
1025 * Used lists must be freed with string_list_free()
1027 void collect_manager_list(GList **names_exc, GList **names_inc, GList **paths)
1030 GList *list = nullptr;
1035 if (names_exc == nullptr && names_inc == nullptr && paths == nullptr)
1040 dir_fd = file_data_new_dir((get_collections_dir()));
1042 filelist_read(dir_fd, &list, nullptr);
1046 fd = static_cast<FileData *>(list->data);
1047 filename = g_strdup(filename_from_path(fd->path));
1049 if (file_extension_match(filename, GQ_COLLECTION_EXT))
1051 name = remove_extension_from_path(filename);
1053 if (names_exc != nullptr)
1055 *names_exc = g_list_insert_sorted(*names_exc, g_strdup(name),
1056 collection_manager_sort_cb);
1057 *names_exc = g_list_first(*names_exc);
1059 if (names_inc != nullptr)
1061 *names_inc = g_list_insert_sorted(*names_inc,filename,
1062 collection_manager_sort_cb);
1063 *names_inc = g_list_first(*names_inc);
1065 if (paths != nullptr)
1067 *paths = g_list_insert_sorted(*paths, g_strdup(fd->path),
1068 collection_manager_sort_cb);
1069 *paths = g_list_first(*paths);
1077 filelist_free(list);
1079 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */