[GRASS-SVN] r32782 - grass/branches/develbranch_6/general/g.gui

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Aug 15 11:25:01 EDT 2008


Author: martinl
Date: 2008-08-15 11:25:01 -0400 (Fri, 15 Aug 2008)
New Revision: 32782

Modified:
   grass/branches/develbranch_6/general/g.gui/main.c
Log:
g.gui: don't initialize type->answer before calling G_parser(), 'gui' parameter not required
merge from trunk, r32776 and r32781)


Modified: grass/branches/develbranch_6/general/g.gui/main.c
===================================================================
--- grass/branches/develbranch_6/general/g.gui/main.c	2008-08-15 15:16:41 UTC (rev 32781)
+++ grass/branches/develbranch_6/general/g.gui/main.c	2008-08-15 15:25:01 UTC (rev 32782)
@@ -40,19 +40,12 @@
     type = G_define_option();
     type->key = "gui";
     type->type = TYPE_STRING;
-    type->required = YES;
-    type->description = _("GUI type");
+    type->label = _("GUI type");
+    type->description = _("Default value: GRASS_GUI if defined otherwise tcltk");
     type->descriptions = _("tcltk;Tcl/Tk based GUI - GIS Manager (gis.m);"
 			   "oldtcltk;Old Tcl/Tk based GUI - Display Manager (d.m);"
 			   "wxpython;wxPython based next generation GUI");
     type->options = "tcltk,oldtcltk,wxpython";
-    gui_type_env = G__getenv("GRASS_GUI");
-    if (gui_type_env && strcmp(gui_type_env, "text")) {
-	type->answer = G_store(gui_type_env);
-    }
-    else {
-	type->answer = "tcltk";
-    }
 
     rc_file = G_define_standard_option(G_OPT_F_INPUT);
     rc_file->key = "workspace";
@@ -65,8 +58,17 @@
 
     if (argc > 1 && G_parser(argc, argv))
 	exit(EXIT_FAILURE);
+    
+    if (!type->answer) {
+	gui_type_env = G__getenv("GRASS_GUI");
+	if (gui_type_env && strcmp(gui_type_env, "text")) {
+	    type->answer = G_store(gui_type_env);
+	}
+	else {
+	    type->answer = "tcltk";
+	}
+    }
 
-
     if (((gui_type_env && oneoff->answer) &&
 	 strcmp(gui_type_env, type->answer) != 0) || !gui_type_env) {
 	G_message(_("<%s> is now the default GUI"), type->answer);



More information about the grass-commit mailing list