[eog] Add --version command line parameter



commit e39dae81cbe687bfd10c4c854e4defd871841486
Author: Felix Riemann <friemann gnome org>
Date:   Sat Apr 17 16:08:29 2010 +0200

    Add --version command line parameter
    
    (bug 615531)

 src/main.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/main.c b/src/main.c
index c37dd32..03c2241 100644
--- a/src/main.c
+++ b/src/main.c
@@ -58,6 +58,17 @@ static gboolean force_new_instance = FALSE;
 #endif
 static gchar **startup_files = NULL;
 
+static gboolean
+_print_version_and_exit (const gchar *option_name,
+			 const gchar *value,
+			 gpointer data,
+			 GError **error)
+{
+	g_print("%s %s\n", _("Eye of GNOME Image Viewer"), VERSION);
+	exit (EXIT_SUCCESS);
+	return TRUE;
+}
+
 static const GOptionEntry goption_options[] =
 {
 	{ "fullscreen", 'f', 0, G_OPTION_ARG_NONE, &fullscreen, N_("Open in fullscreen mode"), NULL  },
@@ -66,6 +77,8 @@ static const GOptionEntry goption_options[] =
 #if HAVE_DBUS
 	{ "new-instance", 'n', 0, G_OPTION_ARG_NONE, &force_new_instance, N_("Start a new instance instead of reusing an existing one"), NULL },
 #endif
+	{ "version", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
+	  _print_version_and_exit, N_("Show the application's version"), NULL},
 	{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &startup_files, NULL, N_("[FILEâ?¦]") },
 	{ NULL }
 };



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]