Add a --collection toggle

One possible use of it is to avoid thumbnailing the parent directory.
This commit is contained in:
Přemysl Eric Janouch 2024-01-26 16:54:57 +01:00
parent c1418c7462
commit 67433f3776
Signed by: p
GPG Key ID: A0420B94F92B9493
2 changed files with 11 additions and 4 deletions

View File

@ -32,6 +32,10 @@ Options
handler to implement the "Open Containing Folder" feature of certain
applications.
*--collection*::
Always put arguments in a virtual directory, even when only one is passed.
Implies *--browse*.
*--help-all*::
Show the full list of options, including those provided by GTK+.

11
fiv.c
View File

@ -2453,7 +2453,7 @@ on_app_startup(GApplication *app, G_GNUC_UNUSED gpointer user_data)
}
static struct {
gboolean browse, extract_thumbnail;
gboolean browse, collection, extract_thumbnail;
gchar **args, *thumbnail_size, *thumbnail_size_search;
} o;
@ -2463,12 +2463,12 @@ on_app_activate(
{
// XXX: We follow the behaviour of Firefox and Eye of GNOME, which both
// interpret multiple command line arguments differently, as a collection.
// However, single-element collections are unrepresentable this way.
// Should we allow multiple targets only in a special new mode?
// However, single-element collections are unrepresentable this way,
// so we have a switch to enforce it.
g.files_index = -1;
if (o.args) {
const gchar *target = *o.args;
if (o.args[1]) {
if (o.args[1] || o.collection) {
fiv_collection_reload(o.args);
target = FIV_COLLECTION_SCHEME ":/";
}
@ -2619,6 +2619,9 @@ main(int argc, char *argv[])
{"browse", 0, G_OPTION_FLAG_IN_MAIN,
G_OPTION_ARG_NONE, &o.browse,
"Start in filesystem browsing mode", NULL},
{"collection", 0, G_OPTION_FLAG_IN_MAIN,
G_OPTION_ARG_NONE, &o.collection,
"Always put arguments in a collection (implies --browse)", NULL},
{"invalidate-cache", 0, G_OPTION_FLAG_IN_MAIN,
G_OPTION_ARG_NONE, NULL,
"Invalidate the wide thumbnail cache", NULL},