[anjuta] Add missing --version command line option



commit eb5d347db72bf37fd492951c38efc89d70a52c16
Author: Sébastien Granjoux <seb sfo free fr>
Date:   Sun Mar 7 16:07:01 2010 +0100

    Add missing --version command line option

 src/main.c |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/src/main.c b/src/main.c
index ec64f73..6304cdb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -55,6 +55,18 @@ static gboolean proper_shutdown = 0;
 static gchar *anjuta_geometry = NULL;
 static gchar **anjuta_filenames = NULL;
 
+static gboolean
+show_version_cb (const char *option_name,
+				const char *value,
+				gpointer data,
+				GError **error)
+{
+	g_print ("%s\n", PACKAGE_STRING);
+	exit (0);
+
+	return TRUE;
+}
+
 static const GOptionEntry anjuta_options[] = {
 	{
 		"geometry", 'g', 0, G_OPTION_ARG_STRING,
@@ -95,6 +107,12 @@ static const GOptionEntry anjuta_options[] = {
 		NULL
 	},
 	{
+		"version", 'v', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
+		&show_version_cb,
+		("Display program version"),
+		NULL
+	},
+	{
 		G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY,
 		&anjuta_filenames,
 		NULL,
@@ -176,7 +194,7 @@ main (int argc, char *argv[])
 	/* Initialize gnome program */
 	if (!g_option_context_parse (context, &argc, &argv, &error))
 	{
-		DEBUG_PRINT ("Option parsing failed: %s", error->message);
+		g_debug ("Option parsing failed: %s", error->message);
 		exit(1);
 	}
 	
@@ -223,7 +241,7 @@ main (int argc, char *argv[])
 			if (response == UNIQUE_RESPONSE_OK)
 				return 0;
 			else
-				DEBUG_PRINT("Faild to contact first instance, starting up normally");
+				DEBUG_PRINT("Failed to contact first instance, starting up normally");
 		}
 	}
 	



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