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 typedef struct _CollectManagerEntry 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 = NULL;
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;
81 GString *extended_filename_buffer = g_string_new(NULL);
86 collection_load_stop(cd);
89 collect_manager_flush();
91 entry = collect_manager_get_entry(path);
95 collection_list_free(cd->list);
100 if (!path && !cd->path) return FALSE;
102 if (!path) path = cd->path;
104 pathl = path_from_utf8(path);
106 DEBUG_1("collection load: append=%d flush=%d only_geometry=%d path=%s",
107 append, flush, only_geometry, pathl);
110 f = fopen(pathl, "r");
114 log_printf("Failed to open collection file: \"%s\"\n", path);
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;
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 *UNUSED(tl), gpointer data)
298 CollectionData *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 *UNUSED(tl), gpointer data)
306 CollectionData *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, NULL, 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 = NULL;
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 CollectInfo *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;
489 COLLECTION_MANAGER_UPDATE,
490 COLLECTION_MANAGER_ADD,
491 COLLECTION_MANAGER_REMOVE
492 } CollectManagerType;
494 typedef struct _CollectManagerAction CollectManagerAction;
495 struct _CollectManagerAction
500 CollectManagerType type;
506 static GList *collection_manager_entry_list = NULL;
507 static GList *collection_manager_action_list = NULL;
508 static GList *collection_manager_action_tail = NULL;
509 static guint collection_manager_timer_id = 0; /* event source id */
512 static CollectManagerAction *collect_manager_action_new(const gchar *oldpath, const gchar *newpath,
513 CollectManagerType type)
515 CollectManagerAction *action;
517 action = g_new0(CollectManagerAction, 1);
520 action->oldpath = g_strdup(oldpath);
521 action->newpath = g_strdup(newpath);
528 static void collect_manager_action_ref(CollectManagerAction *action)
533 static void collect_manager_action_unref(CollectManagerAction *action)
537 if (action->ref > 0) return;
539 g_free(action->oldpath);
540 g_free(action->newpath);
544 static void collect_manager_entry_free_data(CollectManagerEntry *entry)
548 work = entry->add_list;
551 CollectManagerAction *action;
553 action = static_cast<CollectManagerAction *>(work->data);
556 collect_manager_action_unref(action);
558 g_list_free(entry->add_list);
559 if (g_hash_table_size(entry->oldpath_hash) > 0)
560 g_hash_table_destroy(entry->oldpath_hash);
562 g_hash_table_unref(entry->oldpath_hash);
563 if (g_hash_table_size(entry->newpath_hash) > 0)
564 g_hash_table_destroy(entry->newpath_hash);
566 g_hash_table_unref(entry->newpath_hash);
569 static void collect_manager_entry_init_data(CollectManagerEntry *entry)
571 entry->add_list = NULL;
572 entry->oldpath_hash = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, (GDestroyNotify) collect_manager_action_unref);
573 entry->newpath_hash = g_hash_table_new(g_str_hash, g_str_equal);
578 static CollectManagerEntry *collect_manager_entry_new(const gchar *path)
580 CollectManagerEntry *entry;
582 entry = g_new0(CollectManagerEntry, 1);
583 entry->path = g_strdup(path);
584 collect_manager_entry_init_data(entry);
586 collection_manager_entry_list = g_list_append(collection_manager_entry_list, entry);
592 static void collect_manager_entry_free(CollectManagerEntry *entry)
594 collection_manager_entry_list = g_list_remove(collection_manager_entry_list, entry);
596 collect_manager_entry_free_data(entry);
602 static void collect_manager_entry_reset(CollectManagerEntry *entry)
604 collect_manager_entry_free_data(entry);
605 collect_manager_entry_init_data(entry);
608 static CollectManagerEntry *collect_manager_get_entry(const gchar *path)
612 work = collection_manager_entry_list;
615 CollectManagerEntry *entry;
617 entry = static_cast<CollectManagerEntry *>(work->data);
619 if (strcmp(entry->path, path) == 0)
628 static void collect_manager_entry_add_action(CollectManagerEntry *entry, CollectManagerAction *action)
631 CollectManagerAction *orig_action;
633 entry->empty = FALSE;
635 if (action->oldpath == NULL)
638 if (action->newpath == NULL)
643 orig_action = static_cast<CollectManagerAction *>(g_hash_table_lookup(entry->newpath_hash, action->newpath));
646 /* target already exists */
647 log_printf("collection manager failed to add another action for target %s in collection %s\n",
648 action->newpath, entry->path);
651 entry->add_list = g_list_append(entry->add_list, action);
652 g_hash_table_insert(entry->newpath_hash, action->newpath, action);
653 collect_manager_action_ref(action);
657 orig_action = static_cast<CollectManagerAction *>(g_hash_table_lookup(entry->newpath_hash, action->oldpath));
660 /* new action with the same file */
661 CollectManagerAction *new_action = collect_manager_action_new(orig_action->oldpath, action->newpath, action->type);
663 if (new_action->oldpath)
665 g_hash_table_steal(entry->oldpath_hash, orig_action->oldpath);
666 g_hash_table_insert(entry->oldpath_hash, new_action->oldpath, new_action);
670 GList *work = g_list_find(entry->add_list, orig_action);
671 work->data = new_action;
674 g_hash_table_steal(entry->newpath_hash, orig_action->newpath);
675 if (new_action->newpath)
677 g_hash_table_insert(entry->newpath_hash, new_action->newpath, new_action);
679 collect_manager_action_unref(orig_action);
684 orig_action = static_cast<CollectManagerAction *>(g_hash_table_lookup(entry->oldpath_hash, action->oldpath));
687 /* another action for the same source, ignore */
688 log_printf("collection manager failed to add another action for source %s in collection %s\n",
689 action->oldpath, entry->path);
693 g_hash_table_insert(entry->oldpath_hash, action->oldpath, action);
696 g_hash_table_insert(entry->newpath_hash, action->newpath, action);
698 collect_manager_action_ref(action);
701 static gboolean collect_manager_process_action(CollectManagerEntry *entry, gchar **path_ptr)
703 gchar *path = *path_ptr;
704 CollectManagerAction *action;
711 action = static_cast<CollectManagerAction *>(entry->add_list->data);
712 g_assert(action->oldpath == NULL);
713 entry->add_list = g_list_remove(entry->add_list, action);
714 path = g_strdup(action->newpath);
715 g_hash_table_remove(entry->newpath_hash, path);
716 collect_manager_action_unref(action);
719 return (path != NULL);
722 action = static_cast<CollectManagerAction *>(g_hash_table_lookup(entry->oldpath_hash, path));
726 strcpy(*path_ptr, action->newpath);
730 return FALSE; /* no change */
733 static void collect_manager_refresh(void)
739 dir_fd = file_data_new_dir(get_collections_dir());
740 filelist_read(dir_fd, &list, NULL);
741 file_data_unref(dir_fd);
743 work = collection_manager_entry_list;
746 CollectManagerEntry *entry;
749 entry = static_cast<CollectManagerEntry *>(work->data);
753 while (list_step && entry)
757 fd = static_cast<FileData *>(list_step->data);
758 list_step = list_step->next;
760 if (strcmp(fd->path, entry->path) == 0)
762 list = g_list_remove(list, fd);
769 collect_manager_entry_free(entry);
781 fd = static_cast<FileData *>(work->data);
784 collect_manager_entry_new(fd->path);
790 static void collect_manager_process_actions(gint max)
792 if (collection_manager_action_list) DEBUG_1("collection manager processing actions");
794 while (collection_manager_action_list != NULL && max > 0)
796 CollectManagerAction *action;
799 action = static_cast<CollectManagerAction *>(collection_manager_action_list->data);
800 work = collection_manager_entry_list;
803 CollectManagerEntry *entry;
805 entry = static_cast<CollectManagerEntry *>(work->data);
808 if (action->type == COLLECTION_MANAGER_UPDATE)
810 collect_manager_entry_add_action(entry, action);
812 else if (action->oldpath && action->newpath &&
813 strcmp(action->newpath, entry->path) == 0)
815 /* convert action to standard add format */
816 g_free(action->newpath);
817 if (action->type == COLLECTION_MANAGER_ADD)
819 action->newpath = action->oldpath;
820 action->oldpath = NULL;
822 else if (action->type == COLLECTION_MANAGER_REMOVE)
824 action->newpath = NULL;
826 collect_manager_entry_add_action(entry, action);
832 if (action->type != COLLECTION_MANAGER_UPDATE &&
833 action->oldpath && action->newpath)
835 log_printf("collection manager failed to %s %s for collection %s\n",
836 (action->type == COLLECTION_MANAGER_ADD) ? "add" : "remove",
837 action->oldpath, action->newpath);
840 if (collection_manager_action_tail == collection_manager_action_list)
842 collection_manager_action_tail = NULL;
844 collection_manager_action_list = g_list_remove(collection_manager_action_list, action);
845 collect_manager_action_unref(action);
849 static gboolean collect_manager_process_entry(CollectManagerEntry *entry)
853 if (entry->empty) return FALSE;
855 cd = collection_new(entry->path);
856 (void) collection_load_private(cd, entry->path, COLLECTION_LOAD_NONE);
858 collection_unref(cd);
863 static gboolean collect_manager_process_entry_list(void)
867 work = collection_manager_entry_list;
870 CollectManagerEntry *entry;
872 entry = static_cast<CollectManagerEntry *>(work->data);
874 if (collect_manager_process_entry(entry)) return TRUE;
882 static gboolean collect_manager_process_cb(gpointer UNUSED(data))
884 if (collection_manager_action_list) collect_manager_refresh();
885 collect_manager_process_actions(COLLECT_MANAGER_ACTIONS_PER_IDLE);
886 if (collection_manager_action_list) return G_SOURCE_CONTINUE;
888 if (collect_manager_process_entry_list()) return G_SOURCE_CONTINUE;
890 DEBUG_1("collection manager is up to date");
891 return G_SOURCE_REMOVE;
894 static gboolean collect_manager_timer_cb(gpointer UNUSED(data))
896 DEBUG_1("collection manager timer expired");
898 g_idle_add_full(G_PRIORITY_LOW, collect_manager_process_cb, NULL, NULL);
900 collection_manager_timer_id = 0;
904 static void collect_manager_timer_push(gint stop)
906 if (collection_manager_timer_id)
910 g_source_remove(collection_manager_timer_id);
911 collection_manager_timer_id = 0;
916 collection_manager_timer_id = g_timeout_add(COLLECT_MANAGER_FLUSH_DELAY,
917 collect_manager_timer_cb, NULL);
918 DEBUG_1("collection manager timer started");
922 static void collect_manager_add_action(CollectManagerAction *action)
926 /* we keep track of the list's tail to keep this a n(1) operation */
928 if (collection_manager_action_tail)
930 collection_manager_action_tail = g_list_append(collection_manager_action_tail, action);
931 collection_manager_action_tail = collection_manager_action_tail->next;
935 collection_manager_action_list = g_list_append(collection_manager_action_list, action);
936 collection_manager_action_tail = collection_manager_action_list;
939 collect_manager_timer_push(FALSE);
942 void collect_manager_moved(FileData *fd)
944 CollectManagerAction *action;
945 const gchar *oldpath = fd->change->source;
946 const gchar *newpath = fd->change->dest;
948 action = collect_manager_action_new(oldpath, newpath, COLLECTION_MANAGER_UPDATE);
949 collect_manager_add_action(action);
952 void collect_manager_add(FileData *fd, const gchar *collection)
954 CollectManagerAction *action;
957 if (!fd || !collection) return;
959 cw = collection_window_find_by_path(collection);
962 if (collection_list_find_fd(cw->cd->list, fd) == NULL)
964 collection_add(cw->cd, fd, FALSE);
969 action = collect_manager_action_new(fd->path, collection, COLLECTION_MANAGER_ADD);
970 collect_manager_add_action(action);
973 void collect_manager_remove(FileData *fd, const gchar *collection)
975 CollectManagerAction *action;
978 if (!fd || !collection) return;
980 cw = collection_window_find_by_path(collection);
983 while (collection_remove(cw->cd, fd));
987 action = collect_manager_action_new(fd->path, collection, COLLECTION_MANAGER_REMOVE);
988 collect_manager_add_action(action);
991 void collect_manager_flush(void)
993 collect_manager_timer_push(TRUE);
995 DEBUG_1("collection manager flushing");
996 while (collect_manager_process_cb(NULL));
999 void collect_manager_notify_cb(FileData *fd, NotifyType type, gpointer UNUSED(data))
1001 if (!(type & NOTIFY_CHANGE) || !fd->change) return;
1003 DEBUG_1("Notify collect_manager: %s %04x", fd->path, type);
1004 switch (fd->change->type)
1006 case FILEDATA_CHANGE_MOVE:
1007 collect_manager_moved(fd);
1009 case FILEDATA_CHANGE_COPY:
1011 case FILEDATA_CHANGE_RENAME:
1012 collect_manager_moved(fd);
1014 case FILEDATA_CHANGE_DELETE:
1015 case FILEDATA_CHANGE_UNSPECIFIED:
1016 case FILEDATA_CHANGE_WRITE_METADATA:
1021 static gint collection_manager_sort_cb(gconstpointer a, gconstpointer b)
1023 const gchar *char_a = static_cast<const gchar *>(a);
1024 const gchar *char_b = static_cast<const gchar *>(b);
1026 return g_strcmp0(char_a, char_b);
1030 * @brief Creates sorted list of collections
1031 * @param[out] names_exc sorted list of collections names excluding extension
1032 * @param[out] names_inc sorted list of collections names including extension
1033 * @param[out] paths sorted list of collection paths
1035 * Lists of type gchar.
1036 * Used lists must be freed with string_list_free()
1038 void collect_manager_list(GList **names_exc, GList **names_inc, GList **paths)
1046 if (names_exc == NULL && names_inc == NULL && paths == NULL)
1051 dir_fd = file_data_new_dir((get_collections_dir()));
1053 filelist_read(dir_fd, &list, NULL);
1057 fd = static_cast<FileData *>(list->data);
1058 filename = g_strdup(filename_from_path((gchar *)fd->path));
1060 if (file_extension_match(filename, GQ_COLLECTION_EXT))
1062 name = remove_extension_from_path(filename);
1064 if (names_exc != NULL)
1066 *names_exc = g_list_insert_sorted(*names_exc, g_strdup(name),
1067 collection_manager_sort_cb);
1068 *names_exc = g_list_first(*names_exc);
1070 if (names_inc != NULL)
1072 *names_inc = g_list_insert_sorted(*names_inc,filename,
1073 collection_manager_sort_cb);
1074 *names_inc = g_list_first(*names_inc);
1078 *paths = g_list_insert_sorted(*paths,fd->path,
1079 collection_manager_sort_cb);
1080 *paths = g_list_first(*paths);
1088 filelist_free(list);
1090 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */