diff options
author | Ross Lagerwall <rosslagerwall@gmail.com> | 2014-03-27 18:31:06 +0000 |
---|---|---|
committer | Ross Lagerwall <rosslagerwall@gmail.com> | 2014-04-11 17:47:23 +0100 |
commit | a29366193100de48df416c07f96daf7b84ee8f30 (patch) | |
tree | 13f4e7bd2f24775394862900053828f025945aa1 | |
parent | 208cf642ca1a070e5695c23afecea40740052a75 (diff) | |
download | gvfs-a29366193100de48df416c07f96daf7b84ee8f30.tar.gz |
Report gvfs version when --version is used
https://bugzilla.gnome.org/show_bug.cgi?id=727132
38 files changed, 298 insertions, 1 deletions
diff --git a/daemon/main.c b/daemon/main.c index 1255ddf6..9c8eba5d 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -134,6 +134,7 @@ main (int argc, char *argv[]) GVfsDaemon *daemon; gboolean replace; gboolean no_fuse; + gboolean show_version; GError *error; guint name_owner_id; GBusNameOwnerFlags flags; @@ -141,6 +142,7 @@ main (int argc, char *argv[]) const GOptionEntry options[] = { { "replace", 'r', 0, G_OPTION_ARG_NONE, &replace, N_("Replace old daemon."), NULL }, { "no-fuse", 0, 0, G_OPTION_ARG_NONE, &no_fuse, N_("Don't start fuse."), NULL }, + { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Show program version."), NULL}, { NULL } }; @@ -163,6 +165,7 @@ main (int argc, char *argv[]) replace = FALSE; no_fuse = FALSE; + show_version = FALSE; if (g_getenv ("GVFS_DISABLE_FUSE") != NULL) no_fuse = TRUE; @@ -184,6 +187,12 @@ main (int argc, char *argv[]) g_option_context_free (context); + if (show_version) + { + g_print (PACKAGE_STRING "\n"); + return 0; + } + loop = g_main_loop_new (NULL, FALSE); daemon = g_vfs_daemon_new (TRUE, replace); diff --git a/man/gvfs-cat.xml b/man/gvfs-cat.xml index 1d731d73..6e0800e6 100644 --- a/man/gvfs-cat.xml +++ b/man/gvfs-cat.xml @@ -64,6 +64,13 @@ text and exits.</para></listitem> </varlistentry> + <varlistentry> + <term><option>--version</option></term> + + <listitem><para>Shows the version number and + exits.</para></listitem> + </varlistentry> + </variablelist> </refsect1> diff --git a/man/gvfs-copy.xml b/man/gvfs-copy.xml index 7b08ba0e..426fc0dc 100644 --- a/man/gvfs-copy.xml +++ b/man/gvfs-copy.xml @@ -64,6 +64,13 @@ </varlistentry> <varlistentry> + <term><option>--version</option></term> + + <listitem><para>Shows the version number and + exits.</para></listitem> + </varlistentry> + + <varlistentry> <term><option>-T</option>, <option>--no-target-directory</option></term> <listitem><para>Don't copy into DEST even if it is a directory.</para></listitem> diff --git a/man/gvfs-info.xml b/man/gvfs-info.xml index b0bff4d2..a56ea89e 100644 --- a/man/gvfs-info.xml +++ b/man/gvfs-info.xml @@ -71,6 +71,13 @@ </varlistentry> <varlistentry> + <term><option>--version</option></term> + + <listitem><para>Shows the version number and + exits.</para></listitem> + </varlistentry> + + <varlistentry> <term><option>-w</option>, <option>--query-writable</option></term> <listitem><para>Show writable attributes and their types.</para></listitem> diff --git a/man/gvfs-ls.xml b/man/gvfs-ls.xml index 104b9b4f..da12e91a 100644 --- a/man/gvfs-ls.xml +++ b/man/gvfs-ls.xml @@ -69,6 +69,13 @@ </varlistentry> <varlistentry> + <term><option>--version</option></term> + + <listitem><para>Shows the version number and + exits.</para></listitem> + </varlistentry> + + <varlistentry> <term><option>-a</option>, <option>--attributes=ATTRIBUTES</option></term> <listitem><para>The attributes to get, specified diff --git a/man/gvfs-mime.xml b/man/gvfs-mime.xml index c7807057..01fd4b9d 100644 --- a/man/gvfs-mime.xml +++ b/man/gvfs-mime.xml @@ -70,6 +70,13 @@ </varlistentry> <varlistentry> + <term><option>--version</option></term> + + <listitem><para>Shows the version number and + exits.</para></listitem> + </varlistentry> + + <varlistentry> <term><option>--query</option></term> <listitem><para>Query the handler for MIMETYPE.</para></listitem> diff --git a/man/gvfs-mkdir.xml b/man/gvfs-mkdir.xml index 0be444a1..36ae3d94 100644 --- a/man/gvfs-mkdir.xml +++ b/man/gvfs-mkdir.xml @@ -62,6 +62,13 @@ </varlistentry> <varlistentry> + <term><option>--version</option></term> + + <listitem><para>Shows the version number and + exits.</para></listitem> + </varlistentry> + + <varlistentry> <term><option>-p</option>, <option>--parent</option></term> <listitem><para>Create parent directories when necessary.</para></listitem> diff --git a/man/gvfs-monitor-dir.xml b/man/gvfs-monitor-dir.xml index c25d5a14..b2506cb0 100644 --- a/man/gvfs-monitor-dir.xml +++ b/man/gvfs-monitor-dir.xml @@ -65,6 +65,13 @@ </varlistentry> <varlistentry> + <term><option>--version</option></term> + + <listitem><para>Shows the version number and + exits.</para></listitem> + </varlistentry> + + <varlistentry> <term><option>-N</option>, <option>--no-pair</option></term> <listitem><para>Don't send single MOVED events.</para></listitem> diff --git a/man/gvfs-monitor-file.xml b/man/gvfs-monitor-file.xml index 1888024d..41a80451 100644 --- a/man/gvfs-monitor-file.xml +++ b/man/gvfs-monitor-file.xml @@ -65,6 +65,13 @@ </varlistentry> <varlistentry> + <term><option>--version</option></term> + + <listitem><para>Shows the version number and + exits.</para></listitem> + </varlistentry> + + <varlistentry> <term><option>-N</option>, <option>--no-pair</option></term> <listitem><para>Don't send single MOVED events.</para></listitem> diff --git a/man/gvfs-mount.xml b/man/gvfs-mount.xml index 64e28bef..fbe0543f 100644 --- a/man/gvfs-mount.xml +++ b/man/gvfs-mount.xml @@ -75,6 +75,13 @@ </varlistentry> <varlistentry> + <term><option>--version</option></term> + + <listitem><para>Shows the version number and + exits.</para></listitem> + </varlistentry> + + <varlistentry> <term><option>-m</option>, <option>--mountable</option></term> <listitem><para>Mount as a mountable.</para></listitem> diff --git a/man/gvfs-move.xml b/man/gvfs-move.xml index e55765b7..54a1dd45 100644 --- a/man/gvfs-move.xml +++ b/man/gvfs-move.xml @@ -64,6 +64,13 @@ </varlistentry> <varlistentry> + <term><option>--version</option></term> + + <listitem><para>Shows the version number and + exits.</para></listitem> + </varlistentry> + + <varlistentry> <term><option>-T</option>, <option>--no-target-directory</option></term> <listitem><para>Don't move into DEST even if it is a directory.</para></listitem> diff --git a/man/gvfs-open.xml b/man/gvfs-open.xml index 54614fd8..ae84e86b 100644 --- a/man/gvfs-open.xml +++ b/man/gvfs-open.xml @@ -61,6 +61,13 @@ text and exits.</para></listitem> </varlistentry> + <varlistentry> + <term><option>--version</option></term> + + <listitem><para>Shows the version number and + exits.</para></listitem> + </varlistentry> + </variablelist> </refsect1> diff --git a/man/gvfs-rename.xml b/man/gvfs-rename.xml index 392f166d..b82a36ac 100644 --- a/man/gvfs-rename.xml +++ b/man/gvfs-rename.xml @@ -61,6 +61,13 @@ text and exits.</para></listitem> </varlistentry> + <varlistentry> + <term><option>--version</option></term> + + <listitem><para>Shows the version number and + exits.</para></listitem> + </varlistentry> + </variablelist> </refsect1> diff --git a/man/gvfs-rm.xml b/man/gvfs-rm.xml index bd9156c0..81746b33 100644 --- a/man/gvfs-rm.xml +++ b/man/gvfs-rm.xml @@ -65,6 +65,13 @@ </varlistentry> <varlistentry> + <term><option>--version</option></term> + + <listitem><para>Shows the version number and + exits.</para></listitem> + </varlistentry> + + <varlistentry> <term><option>-f</option>, <option>--force</option></term> <listitem><para>Ignore nonexistent and diff --git a/man/gvfs-save.xml b/man/gvfs-save.xml index a2b29e2d..ef188f9a 100644 --- a/man/gvfs-save.xml +++ b/man/gvfs-save.xml @@ -64,6 +64,13 @@ </varlistentry> <varlistentry> + <term><option>--version</option></term> + + <listitem><para>Shows the version number and + exits.</para></listitem> + </varlistentry> + + <varlistentry> <term><option>-b</option>, <option>--backup</option></term> <listitem><para>If the destination file already exists, save a backup.</para></listitem> diff --git a/man/gvfs-set-attribute.xml b/man/gvfs-set-attribute.xml index dc9804ab..80de0f05 100644 --- a/man/gvfs-set-attribute.xml +++ b/man/gvfs-set-attribute.xml @@ -64,6 +64,13 @@ </varlistentry> <varlistentry> + <term><option>--version</option></term> + + <listitem><para>Shows the version number and + exits.</para></listitem> + </varlistentry> + + <varlistentry> <term><option>-t</option>, <option>--type=TYPE</option></term> <listitem><para>Specifies the type of the attribute. Supported types are string, stringv, bytestring, boolean, uint32, int32, uint64, int64, object and unset.</para></listitem> diff --git a/man/gvfs-trash.xml b/man/gvfs-trash.xml index c6d5c303..dc53398e 100644 --- a/man/gvfs-trash.xml +++ b/man/gvfs-trash.xml @@ -72,6 +72,13 @@ </varlistentry> <varlistentry> + <term><option>--version</option></term> + + <listitem><para>Shows the version number and + exits.</para></listitem> + </varlistentry> + + <varlistentry> <term><option>-f</option>, <option>--force</option></term> <listitem><para>Ignore nonexistent and diff --git a/man/gvfs-tree.xml b/man/gvfs-tree.xml index 09fd3bd1..25d4fafa 100644 --- a/man/gvfs-tree.xml +++ b/man/gvfs-tree.xml @@ -64,6 +64,13 @@ </varlistentry> <varlistentry> + <term><option>--version</option></term> + + <listitem><para>Shows the version number and + exits.</para></listitem> + </varlistentry> + + <varlistentry> <term><option>-h</option>, <option>--hidden</option></term> <listitem><para>Show hidden files.</para></listitem> diff --git a/man/gvfsd-metadata.xml b/man/gvfsd-metadata.xml index 2614b048..db2e7d47 100644 --- a/man/gvfsd-metadata.xml +++ b/man/gvfsd-metadata.xml @@ -62,6 +62,13 @@ </varlistentry> <varlistentry> + <term><option>--version</option></term> + + <listitem><para>Shows the version number and + exits.</para></listitem> + </varlistentry> + + <varlistentry> <term><option>-r</option>, <option>--replace</option></term> <listitem><para>Replace the currently running instance.</para></listitem> diff --git a/man/gvfsd.xml b/man/gvfsd.xml index 4326e583..f257eeb0 100644 --- a/man/gvfsd.xml +++ b/man/gvfsd.xml @@ -74,6 +74,13 @@ </varlistentry> <varlistentry> + <term><option>--version</option></term> + + <listitem><para>Shows the version number and + exits.</para></listitem> + </varlistentry> + + <varlistentry> <term><option>-r</option>, <option>--replace</option></term> <listitem><para>Replace the currently running gvfsd instance.</para></listitem> diff --git a/metadata/meta-daemon.c b/metadata/meta-daemon.c index 05e16302..73d407d8 100644 --- a/metadata/meta-daemon.c +++ b/metadata/meta-daemon.c @@ -474,12 +474,14 @@ main (int argc, char *argv[]) GMainLoop *loop; GDBusConnection *conn; gboolean replace; + gboolean show_version; GError *error; guint name_owner_id; GBusNameOwnerFlags flags; GOptionContext *context; const GOptionEntry options[] = { { "replace", 'r', 0, G_OPTION_ARG_NONE, &replace, N_("Replace old daemon."), NULL }, + { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Show program version."), NULL}, { NULL } }; @@ -497,6 +499,7 @@ main (int argc, char *argv[]) g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE); replace = FALSE; + show_version = FALSE; name_owner_id = 0; error = NULL; @@ -516,6 +519,12 @@ main (int argc, char *argv[]) g_option_context_free (context); + if (show_version) + { + g_print(PACKAGE_STRING "\n"); + return 0; + } + loop = g_main_loop_new (NULL, FALSE); error = NULL; diff --git a/programs/gvfs-cat.c b/programs/gvfs-cat.c index 45cdd424..a4b944ea 100644 --- a/programs/gvfs-cat.c +++ b/programs/gvfs-cat.c @@ -31,9 +31,11 @@ #include <glib/gi18n.h> #include <gio/gio.h> +static gboolean show_version = FALSE; static gchar **locations = NULL; static GOptionEntry entries[] = { + { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Show program version"), NULL }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &locations, NULL, NULL }, { NULL } }; @@ -171,6 +173,12 @@ main (int argc, char *argv[]) return 1; } + if (show_version) + { + g_print (PACKAGE_STRING "\n"); + return 0; + } + if (!locations) { /* Translators: the %s is the program name. This error message */ diff --git a/programs/gvfs-copy.c b/programs/gvfs-copy.c index c77b4efb..7a61dcf8 100644 --- a/programs/gvfs-copy.c +++ b/programs/gvfs-copy.c @@ -38,6 +38,7 @@ static gboolean no_dereference = FALSE; static gboolean backup = FALSE; static gboolean preserve = FALSE; static gboolean no_target_directory = FALSE; +static gboolean show_version = FALSE; static GOptionEntry entries[] = { @@ -47,6 +48,7 @@ static GOptionEntry entries[] = { "preserve", 'p', 0, G_OPTION_ARG_NONE, &preserve, N_("Preserve all attributes"), NULL }, { "backup", 'b', 0, G_OPTION_ARG_NONE, &backup, N_("Backup existing destination files"), NULL }, { "no-dereference", 'P', 0, G_OPTION_ARG_NONE, &no_dereference, N_("Never follow symbolic links"), NULL }, + { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Show program version"), NULL }, { NULL } }; @@ -134,6 +136,12 @@ main (int argc, char *argv[]) return 1; } + if (show_version) + { + g_print (PACKAGE_STRING "\n"); + return 0; + } + if (argc <= 2) { show_help (context, _("Missing operand\n")); diff --git a/programs/gvfs-info.c b/programs/gvfs-info.c index a685208a..1462fef1 100644 --- a/programs/gvfs-info.c +++ b/programs/gvfs-info.c @@ -31,6 +31,7 @@ static char *attributes = NULL; static gboolean nofollow_symlinks = FALSE; static gboolean filesystem = FALSE; static gboolean writable = FALSE; +static gboolean show_version = FALSE; static GOptionEntry entries[] = { @@ -38,6 +39,7 @@ static GOptionEntry entries[] = { "filesystem", 'f', 0, G_OPTION_ARG_NONE, &filesystem, N_("Get file system info"), NULL }, { "attributes", 'a', 0, G_OPTION_ARG_STRING, &attributes, N_("The attributes to get"), N_("ATTRIBUTES") }, { "nofollow-symlinks", 'n', 0, G_OPTION_ARG_NONE, &nofollow_symlinks, N_("Don't follow symbolic links"), NULL }, + { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Show program version"), NULL }, { NULL } }; @@ -399,6 +401,12 @@ main (int argc, char *argv[]) return 1; } + if (show_version) + { + g_print (PACKAGE_STRING "\n"); + return 0; + } + res = TRUE; if (argc > 1) { diff --git a/programs/gvfs-ls.c b/programs/gvfs-ls.c index 45e39f86..22bf0e8e 100644 --- a/programs/gvfs-ls.c +++ b/programs/gvfs-ls.c @@ -34,6 +34,7 @@ static gboolean show_long = FALSE; static gboolean nofollow_symlinks = FALSE; static char *show_completions = NULL; static gboolean print_uris = FALSE; +static gboolean show_version = FALSE; static GOptionEntry entries[] = { @@ -43,6 +44,7 @@ static GOptionEntry entries[] = { "show-completions", 'c', 0, G_OPTION_ARG_STRING, &show_completions, N_("Show completions"), N_("PREFIX") }, { "nofollow-symlinks", 'n', 0, G_OPTION_ARG_NONE, &nofollow_symlinks, N_("Don't follow symbolic links"), NULL}, { "print-uris", 'u', 0, G_OPTION_ARG_NONE, &print_uris, N_("Print full URIs"), NULL}, + { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Show program version"), NULL }, { NULL } }; @@ -431,6 +433,12 @@ main (int argc, char *argv[]) return 1; } + if (show_version) + { + g_print (PACKAGE_STRING "\n"); + return 0; + } + if (attributes != NULL) { /* asking for attributes implies -l; otherwise it won't get shown */ diff --git a/programs/gvfs-mime.c b/programs/gvfs-mime.c index 22f6d39b..1eaf005a 100644 --- a/programs/gvfs-mime.c +++ b/programs/gvfs-mime.c @@ -30,11 +30,13 @@ static gboolean query = FALSE; static gboolean set = FALSE; +static gboolean show_version = FALSE; static GOptionEntry entries[] = { { "query", 0, 0, G_OPTION_ARG_NONE, &query, N_("Query handler for mime-type"), NULL }, { "set", 0, 0, G_OPTION_ARG_NONE, &set, N_("Set handler for mime-type"), NULL }, + { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Show program version"), NULL }, { NULL } }; @@ -87,7 +89,7 @@ main (int argc, char *argv[]) g_option_context_free (context); g_free (param); - if (error != NULL || query == set) + if (error != NULL || (query == set && !show_version)) { g_printerr (_("Error parsing commandline options: %s\n"), error ? error->message : _("Specify either --query or --set")); @@ -99,6 +101,12 @@ main (int argc, char *argv[]) return 1; } + if (show_version) + { + g_print (PACKAGE_STRING "\n"); + return 0; + } + if (query && argc != 2) { g_printerr (_("Must specify a single mime-type.\n")); diff --git a/programs/gvfs-mkdir.c b/programs/gvfs-mkdir.c index 3eccd3f8..347034f3 100644 --- a/programs/gvfs-mkdir.c +++ b/programs/gvfs-mkdir.c @@ -28,9 +28,12 @@ #include <gio/gio.h> static gboolean parent = FALSE; +static gboolean show_version = FALSE; + static GOptionEntry entries[] = { { "parent", 'p', 0, G_OPTION_ARG_NONE, &parent, N_("Create parent directories"), NULL }, + { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Show program version"), NULL }, { NULL } }; @@ -72,6 +75,12 @@ main (int argc, char *argv[]) return 1; } + if (show_version) + { + g_print (PACKAGE_STRING "\n"); + return 0; + } + if (argc > 1) { int i; diff --git a/programs/gvfs-monitor-dir.c b/programs/gvfs-monitor-dir.c index 54a92139..30d0f6f1 100644 --- a/programs/gvfs-monitor-dir.c +++ b/programs/gvfs-monitor-dir.c @@ -34,8 +34,11 @@ static GMainLoop *main_loop; static gboolean dont_pair_moves = FALSE; +static gboolean show_version = FALSE; + static GOptionEntry entries[] = { { "no-pair", 'N', 0, G_OPTION_ARG_NONE, &dont_pair_moves, N_("Don't send single MOVED events"), NULL }, + { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Show program version"), NULL }, { NULL } }; @@ -127,6 +130,12 @@ main (int argc, char *argv[]) return 1; } + if (show_version) + { + g_print (PACKAGE_STRING "\n"); + return 0; + } + if (argc > 1) { int i; diff --git a/programs/gvfs-monitor-file.c b/programs/gvfs-monitor-file.c index 1fe396f3..8f813d31 100644 --- a/programs/gvfs-monitor-file.c +++ b/programs/gvfs-monitor-file.c @@ -34,8 +34,11 @@ static GMainLoop *main_loop; static gboolean dont_pair_moves = FALSE; +static gboolean show_version = FALSE; + static GOptionEntry entries[] = { { "no-pair", 'N', 0, G_OPTION_ARG_NONE, &dont_pair_moves, N_("Don't send single MOVED events"), NULL }, + { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Show program version"), NULL }, { NULL } }; @@ -126,6 +129,12 @@ main (int argc, char *argv[]) return 1; } + if (show_version) + { + g_print (PACKAGE_STRING "\n"); + return 0; + } + if (argc > 1) { int i; diff --git a/programs/gvfs-mount.c b/programs/gvfs-mount.c index a9b1b586..e35fc025 100644 --- a/programs/gvfs-mount.c +++ b/programs/gvfs-mount.c @@ -50,6 +50,7 @@ static gboolean mount_monitor = FALSE; static const char *unmount_scheme = NULL; static const char *mount_device_file = NULL; static gboolean success = TRUE; +static gboolean show_version = FALSE; static const GOptionEntry entries[] = @@ -63,6 +64,7 @@ static const GOptionEntry entries[] = { "list", 'l', 0, G_OPTION_ARG_NONE, &mount_list, N_("List"), NULL}, { "monitor", 'o', 0, G_OPTION_ARG_NONE, &mount_monitor, N_("Monitor events"), NULL}, { "detail", 'i', 0, G_OPTION_ARG_NONE, &extra_detail, N_("Show extra information"), NULL}, + { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Show program version"), NULL }, { NULL } }; @@ -1058,6 +1060,12 @@ main (int argc, char *argv[]) return 1; } + if (show_version) + { + g_print (PACKAGE_STRING "\n"); + return 0; + } + main_loop = g_main_loop_new (NULL, FALSE); if (mount_list) diff --git a/programs/gvfs-move.c b/programs/gvfs-move.c index 81b3d935..0ad3d635 100644 --- a/programs/gvfs-move.c +++ b/programs/gvfs-move.c @@ -36,6 +36,7 @@ static gboolean progress = FALSE; static gboolean interactive = FALSE; static gboolean backup = FALSE; static gboolean no_target_directory = FALSE; +static gboolean show_version = FALSE; static GOptionEntry entries[] = { @@ -43,6 +44,7 @@ static GOptionEntry entries[] = { "progress", 'p', 0, G_OPTION_ARG_NONE, &progress, N_("Show progress"), NULL }, { "interactive", 'i', 0, G_OPTION_ARG_NONE, &interactive, N_("Prompt before overwrite"), NULL }, { "backup", 'b', 0, G_OPTION_ARG_NONE, &backup, N_("Backup existing destination files"), NULL }, + { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Show program version"), NULL }, { NULL } }; @@ -122,6 +124,12 @@ main (int argc, char *argv[]) return 1; } + if (show_version) + { + g_print (PACKAGE_STRING "\n"); + return 0; + } + if (argc <= 2) { show_help (context, _("Missing operand\n")); diff --git a/programs/gvfs-open.c b/programs/gvfs-open.c index 0dcfccd6..b98d6cf2 100644 --- a/programs/gvfs-open.c +++ b/programs/gvfs-open.c @@ -31,9 +31,11 @@ #include <glib/gi18n.h> #include <gio/gio.h> +static gboolean show_version = FALSE; static gchar **locations = NULL; static GOptionEntry entries[] = { + { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Show program version"), NULL }, {G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &locations, NULL, NULL }, {NULL} }; @@ -79,6 +81,12 @@ main (int argc, char *argv[]) return 1; } + if (show_version) + { + g_print (PACKAGE_STRING "\n"); + return 0; + } + if (!locations) { /* Translators: the %s is the program name. This error message */ diff --git a/programs/gvfs-rename.c b/programs/gvfs-rename.c index f4a1648a..656be160 100644 --- a/programs/gvfs-rename.c +++ b/programs/gvfs-rename.c @@ -27,6 +27,14 @@ #include <glib/gi18n.h> #include <gio/gio.h> +static gboolean show_version = FALSE; + +static GOptionEntry entries[] = +{ + { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Show program version"), NULL }, + { NULL } +}; + static void show_help (GOptionContext *context, const char *error) { @@ -64,6 +72,7 @@ main (int argc, char *argv[]) context = g_option_context_new (param); g_option_context_set_summary (context, summary); + g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE); g_option_context_parse (context, &argc, &argv, &error); if (error != NULL) @@ -76,6 +85,12 @@ main (int argc, char *argv[]) return 1; } + if (show_version) + { + g_print (PACKAGE_STRING "\n"); + return 0; + } + if (argc < 3) { show_help (context, _("Missing operand\n")); diff --git a/programs/gvfs-rm.c b/programs/gvfs-rm.c index 81af7133..069e9228 100644 --- a/programs/gvfs-rm.c +++ b/programs/gvfs-rm.c @@ -28,10 +28,12 @@ #include <gio/gio.h> static gboolean force = FALSE; +static gboolean show_version = FALSE; static GOptionEntry entries[] = { {"force", 'f', 0, G_OPTION_ARG_NONE, &force, N_("Ignore nonexistent files, never prompt"), NULL}, + { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Show program version"), NULL }, { NULL } }; @@ -73,6 +75,12 @@ main (int argc, char *argv[]) return 1; } + if (show_version) + { + g_print (PACKAGE_STRING "\n"); + return 0; + } + if (argc > 1) { int i; diff --git a/programs/gvfs-save.c b/programs/gvfs-save.c index 16c8c97b..51f70b1f 100644 --- a/programs/gvfs-save.c +++ b/programs/gvfs-save.c @@ -37,6 +37,7 @@ static gboolean create = FALSE; static gboolean append = FALSE; static gboolean priv = FALSE; static gboolean print_etag = FALSE; +static gboolean show_version = FALSE; static GOptionEntry entries[] = { @@ -48,6 +49,7 @@ static GOptionEntry entries[] = { "print-etag", 'v', 0, G_OPTION_ARG_NONE, &print_etag, N_("Print new etag at end"), NULL }, /* Translators: The "etag" is a token allowing to verify whether a file has been modified */ { "etag", 'e', 0, G_OPTION_ARG_STRING, &etag, N_("The etag of the file being overwritten"), N_("ETAG") }, + { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Show program version"), NULL }, { NULL } }; @@ -179,6 +181,12 @@ main (int argc, char *argv[]) return 1; } + if (show_version) + { + g_print (PACKAGE_STRING "\n"); + return 0; + } + res = FALSE; if (argc > 1) diff --git a/programs/gvfs-set-attribute.c b/programs/gvfs-set-attribute.c index f593184e..cbf2b2f9 100644 --- a/programs/gvfs-set-attribute.c +++ b/programs/gvfs-set-attribute.c @@ -30,11 +30,13 @@ static char *attr_type = "string"; static gboolean nofollow_symlinks = FALSE; +static gboolean show_version = FALSE; static GOptionEntry entries[] = { { "type", 't', 0, G_OPTION_ARG_STRING, &attr_type, N_("Type of the attribute"), N_("TYPE") }, { "nofollow-symlinks", 'n', 0, G_OPTION_ARG_NONE, &nofollow_symlinks, N_("Don't follow symbolic links"), NULL }, + { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Show program version"), NULL }, { NULL } }; @@ -152,6 +154,12 @@ main (int argc, char *argv[]) return 1; } + if (show_version) + { + g_print (PACKAGE_STRING "\n"); + return 0; + } + if (argc < 2) { show_help (context, _("Location not specified\n")); diff --git a/programs/gvfs-trash.c b/programs/gvfs-trash.c index 36dc02e0..0c714cb0 100644 --- a/programs/gvfs-trash.c +++ b/programs/gvfs-trash.c @@ -62,11 +62,13 @@ delete_trash_file (GFile *file, gboolean del_file, gboolean del_children) static gboolean force = FALSE; static gboolean empty = FALSE; +static gboolean show_version = FALSE; static GOptionEntry entries[] = { { "force", 'f', 0, G_OPTION_ARG_NONE, &force, N_("Ignore nonexistent files, never prompt"), NULL }, { "empty", 0, 0, G_OPTION_ARG_NONE, &empty, N_("Empty the trash"), NULL }, + { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Show program version"), NULL }, { NULL } }; @@ -107,6 +109,12 @@ main (int argc, char *argv[]) return 1; } + if (show_version) + { + g_print (PACKAGE_STRING "\n"); + return 0; + } + if (argc > 1) { int i; diff --git a/programs/gvfs-tree.c b/programs/gvfs-tree.c index 412f722d..e5774899 100644 --- a/programs/gvfs-tree.c +++ b/programs/gvfs-tree.c @@ -30,11 +30,13 @@ static gboolean show_hidden = FALSE; static gboolean follow_symlinks = FALSE; +static gboolean show_version = FALSE; static GOptionEntry entries[] = { { "hidden", 'h', 0, G_OPTION_ARG_NONE, &show_hidden, N_("Show hidden files"), NULL }, { "follow-symlinks", 'l', 0, G_OPTION_ARG_NONE, &follow_symlinks, N_("Follow symbolic links, mounts and shortcuts"), NULL }, + { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Show program version"), NULL }, { NULL } }; @@ -264,6 +266,12 @@ main (int argc, char *argv[]) return 1; } + if (show_version) + { + g_print (PACKAGE_STRING "\n"); + return 0; + } + if (argc > 1) { int i; |