Mercurial > hg > forks > geeqie
diff src/collect.c @ 2878:8b1c451c8ff2
Additional remote commands
--get-filelist:[<FOLDER>] Get list of files and class
--get-filelist-recurse:[<FOLDER>] Get list of files and class recursive
--get-collection:<COLLECTION> Get collection content
--get-collection-list Get list of collections
Changed command:
--tell Print filename of current image [and Collection, if collection
being displayed]
author | Colin Clark <colin.clark@cclark.uk> |
---|---|
date | Fri, 04 Jan 2019 13:44:58 +0000 |
parents | b20a96b979a3 |
children | 2e7fd08bfbe4 |
line wrap: on
line diff
--- a/src/collect.c Thu Dec 20 11:45:20 2018 +0000 +++ b/src/collect.c Fri Jan 04 13:44:58 2019 +0000 @@ -345,7 +345,7 @@ * * Return value must be freed with g_free() */ -gchar *collection_path(gchar *param) +gchar *collection_path(const gchar *param) { gchar *path = NULL; gchar *full_name = NULL; @@ -377,7 +377,7 @@ * * */ -gboolean is_collection(gchar *param) +gboolean is_collection(const gchar *param) { gchar *name = NULL; @@ -390,6 +390,41 @@ return FALSE; } +/** + * @brief Creates a text list of the image paths of the contents of a Collection + * @param[in] name The name of the collection, with or wihout extension + * @param[inout] contents A GString to which the image paths are appended + * + * + */ +void collection_contents(const gchar *name, GString **contents) +{ + gchar *path; + CollectionData *cd; + CollectInfo *ci; + GList *work; + FileData *fd; + + if (is_collection(name)) + { + path = collection_path(name); + cd = collection_new(""); + collection_load(cd, path, COLLECTION_LOAD_APPEND); + work = cd->list; + while (work) + { + ci = work->data; + fd = ci->fd; + *contents = g_string_append(*contents, g_strdup(fd->path)); + *contents = g_string_append(*contents, "\n"); + + work = work->next; + } + g_free(path); + collection_free(cd); + } +} + /* *------------------------------------------------------------------- * please use these to actually add/remove stuff