SF.net SVN: geany: [2116] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Wed Dec 19 13:49:59 UTC 2007


Revision: 2116
          http://geany.svn.sourceforge.net/geany/?rev=2116&view=rev
Author:   eht16
Date:     2007-12-19 05:49:59 -0800 (Wed, 19 Dec 2007)

Log Message:
-----------
Apply patch Jeff Pohlmeyer to handle unknown command line options better (thanks).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/TODO
    trunk/src/main.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-12-18 21:46:49 UTC (rev 2115)
+++ trunk/ChangeLog	2007-12-19 13:49:59 UTC (rev 2116)
@@ -1,3 +1,9 @@
+2007-12-19  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
+
+ * TODO, src/main.c: Apply patch Jeff Pohlmeyer to handle unknown
+                     command line options better (thanks).
+
+
 2007-12-18  Frank Lanitz  <frank(at)frank(dot)uvena(dot)de>
 
  * src/about.c, THANKS, po/uk_UA.po, po/LINGUAS:

Modified: trunk/TODO
===================================================================
--- trunk/TODO	2007-12-18 21:46:49 UTC (rev 2115)
+++ trunk/TODO	2007-12-19 13:49:59 UTC (rev 2116)
@@ -5,7 +5,6 @@
 	Fix bugs:
 	o fix bug that prevents UTF-16, UTF-32 files from being loaded.
 	o tagmanager fails on UTF-16/32
-	o fix parsing command line args after given filenames
 
 	Next version or later:
 

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2007-12-18 21:46:49 UTC (rev 2115)
+++ trunk/src/main.c	2007-12-19 13:49:59 UTC (rev 2116)
@@ -158,6 +158,7 @@
 	}
 }
 
+
 /* special things for the initial setup of the checkboxes and related stuff
  * an action on a setting is only performed if the setting is not equal to the program default
  * (all the following code is not perfect but it works for the moment) */
@@ -421,7 +422,6 @@
 
 static void parse_command_line_options(gint *argc, gchar ***argv)
 {
-	GOptionContext *context;
 	GError *error = NULL;
 
 	// first initialise cl_options fields with default values
@@ -429,13 +429,15 @@
 	cl_options.goto_line = -1;
 	cl_options.goto_column = -1;
 
-	context = g_option_context_new(_("[FILES...]"));
-	g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE);
-	g_option_group_set_translation_domain(g_option_context_get_main_group(context), GETTEXT_PACKAGE);
-	g_option_context_add_group(context, gtk_get_option_group(TRUE));
-	g_option_context_parse(context, argc, argv, &error);
-	g_option_context_free(context);
+	gtk_init_with_args(argc, argv, _("[FILES...]"), entries, GETTEXT_PACKAGE, &error);
 
+	if (error != NULL)
+	{
+		g_printerr("Geany: %s\n", error->message);
+		g_error_free(error);
+		exit(1);
+	}
+
 	if (show_version)
 	{
 		printf(PACKAGE " " VERSION " ");
@@ -639,6 +641,7 @@
 
 	setup_paths();
 	locale_init();
+	// gtk_init() is called within parse_command_line_options()
 	parse_command_line_options(&argc, &argv);
 
 	gtk_set_locale();
@@ -681,7 +684,6 @@
 		VERSION,
 		gtk_major_version, gtk_minor_version, gtk_micro_version,
 		glib_major_version, glib_minor_version, glib_micro_version);
-	gtk_init(&argc, &argv);
 
 	// inits
 	main_init();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list