[Goodies-commits] r3395 - ristretto/trunk/src

Stephan Arts stephan at xfce.org
Tue Oct 16 22:44:29 CEST 2007


Author: stephan
Date: 2007-10-16 20:44:29 +0000 (Tue, 16 Oct 2007)
New Revision: 3395

Modified:
   ristretto/trunk/src/main.c
Log:
Add --version cli option.



Modified: ristretto/trunk/src/main.c
===================================================================
--- ristretto/trunk/src/main.c	2007-10-16 20:40:34 UTC (rev 3394)
+++ ristretto/trunk/src/main.c	2007-10-16 20:44:29 UTC (rev 3395)
@@ -39,9 +39,21 @@
 static gboolean
 cb_rstto_main_window_configure_event (GtkWidget *widget, GdkEventConfigure *event);
 
+gboolean version = FALSE;
+
+static GOptionEntry entries[] =
+{
+    {	"version", 'v', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &version,
+		N_("Version information"),
+		NULL
+	},
+	{ NULL }
+};
+
 int main(int argc, char **argv)
 {
 
+	GError *cli_error = NULL;
     gint n;
 
     #ifdef ENABLE_NLS
@@ -50,8 +62,22 @@
     textdomain (GETTEXT_PACKAGE);
     #endif
 
-    gtk_init(&argc, &argv);
+    if(!gtk_init_with_args(&argc, &argv, _(""), entries, PACKAGE, NULL))
+    {
+        if (cli_error != NULL)
+        {
+			g_print (_("%s: %s\nTry %s --help to see a full list of available command line options.\n"), PACKAGE, cli_error->message, PACKAGE_NAME);
+			g_error_free (cli_error);
+			return 1;
+        }
+    }
 
+	if(version)
+	{
+		g_print("%s\n", PACKAGE_STRING);
+		return 0;
+	}
+
     thunar_vfs_init();
 
     mime_dbase = thunar_vfs_mime_database_get_default();




More information about the Goodies-commits mailing list