[GRASS-SVN] r35972 - grass/branches/develbranch_6/general/g.gui
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Feb 20 02:38:46 EST 2009
Author: hamish
Date: 2009-02-20 02:38:46 -0500 (Fri, 20 Feb 2009)
New Revision: 35972
Modified:
grass/branches/develbranch_6/general/g.gui/main.c
Log:
allow (re)setting the default GUI without launching it
Modified: grass/branches/develbranch_6/general/g.gui/main.c
===================================================================
--- grass/branches/develbranch_6/general/g.gui/main.c 2009-02-20 07:22:34 UTC (rev 35971)
+++ grass/branches/develbranch_6/general/g.gui/main.c 2009-02-20 07:38:46 UTC (rev 35972)
@@ -25,7 +25,7 @@
int main(int argc, char *argv[])
{
struct Option *type, *rc_file;
- struct Flag *oneoff;
+ struct Flag *update, *nolaunch;
struct GModule *module;
char *gui_type_env;
char progname[GPATH_MAX];
@@ -44,23 +44,37 @@
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";
+ "wxpython;wxPython based next generation GUI;"
+ "text;command line interface only");
+ type->options = "tcltk,oldtcltk,wxpython,text";
rc_file = G_define_standard_option(G_OPT_F_INPUT);
rc_file->key = "workspace";
rc_file->required = NO;
rc_file->description = _("Name of workspace file");
- oneoff = G_define_flag();
- oneoff->key = 'u';
- oneoff->description = _("Update default GUI setting");
+ update = G_define_flag();
+ update->key = 'u';
+ update->description = _("Update default GUI setting");
+ nolaunch = G_define_flag();
+ nolaunch->key = 'n';
+ nolaunch->description =
+ _("Do not launch GUI after updating the default GUI setting");
+
if (argc > 1 && G_parser(argc, argv))
exit(EXIT_FAILURE);
-
+
+
+ if( type->answer && strcmp(type->answer, "text") == 0
+ && !nolaunch->answer)
+ nolaunch->answer = TRUE;
+
+ if(nolaunch->answer && !update->answer)
+ update->answer = TRUE;
+
gui_type_env = G__getenv("GRASS_GUI");
-
+
if (!type->answer) {
if (gui_type_env && strcmp(gui_type_env, "text")) {
type->answer = G_store(gui_type_env);
@@ -70,13 +84,17 @@
}
}
- if (((gui_type_env && oneoff->answer) &&
+ if (((gui_type_env && update->answer) &&
strcmp(gui_type_env, type->answer) != 0) || !gui_type_env) {
G_message(_("<%s> is now the default GUI"), type->answer);
G_setenv("GRASS_GUI", type->answer);
}
+ if(nolaunch->answer)
+ exit(EXIT_SUCCESS);
+
+
if (strcmp(type->answer, "oldtcltk") == 0) {
sprintf(progname, "%s/etc/dm/d.m.tcl", G_gisbase());
if (rc_file->answer) {
More information about the grass-commit
mailing list