From 67433f377693d1598a14da8bbb82136247dd5810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Fri, 26 Jan 2024 16:54:57 +0100 Subject: Add a --collection toggle One possible use of it is to avoid thumbnailing the parent directory. --- docs/fiv.adoc | 4 ++++ fiv.c | 11 +++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/fiv.adoc b/docs/fiv.adoc index 5285d5d..0188086 100644 --- a/docs/fiv.adoc +++ b/docs/fiv.adoc @@ -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+. diff --git a/fiv.c b/fiv.c index 0b50f31..ad73537 100644 --- a/fiv.c +++ b/fiv.c @@ -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}, -- cgit v1.2.3