Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#7255) options aren't saved by default
Home

[Freeciv-Dev] (PR#7255) options aren't saved by default

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#7255) options aren't saved by default
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 22 Sep 2004 17:15:57 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7255 >

> [jdorje - Fri Jan 16 23:04:28 2004]:
> 
> Unless you choose "save options" from the menu your options are not 
> saved by default.
> 
> Seems to me they should be saved automatically when you exit.  If 
> desired a "revert" menu option can be provided to re-load the original 
> options (thus avoiding saving them).

This is easy enough to fix.  This patch does it.

We have to call ui_exit() instead of exit() from the GUI code to get the
client to "properly" shut down.  Seems obvious that this is the correct
thing to do.  But it's possible it causes problems somewhere - I didn't
run into any during my testing.

jason

Index: client/civclient.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/civclient.c,v
retrieving revision 1.196
diff -u -r1.196 civclient.c
--- client/civclient.c  21 Sep 2004 05:00:50 -0000      1.196
+++ client/civclient.c  23 Sep 2004 00:14:32 -0000
@@ -319,6 +319,9 @@
   my_shutdown_network();
 
   client_game_free();
+  if (save_options_on_exit) {
+    save_options();
+  }
 
   exit(EXIT_SUCCESS);
 }
Index: client/options.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/options.c,v
retrieving revision 1.103
diff -u -r1.103 options.c
--- client/options.c    26 Aug 2004 07:59:01 -0000      1.103
+++ client/options.c    23 Sep 2004 00:14:32 -0000
@@ -52,6 +52,7 @@
 
 /** Local Options: **/
 
+bool save_options_on_exit = TRUE;
 bool solid_color_behind_units = FALSE;
 bool sound_bell_at_new_turn = FALSE;
 int  smooth_move_unit_msec = 30;
@@ -76,6 +77,8 @@
 bool update_city_text_in_refresh_tile = TRUE;
 
 static client_option common_options[] = {
+  GEN_BOOL_OPTION(save_options_on_exit,
+                 N_("Save the options when exiting the game")),
   GEN_STR_OPTION(default_user_name,        N_("Default player's login name"),
                 NULL, NULL), 
   GEN_STR_OPTION(default_server_host,       N_("Default server"),
Index: client/options.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/options.h,v
retrieving revision 1.38
diff -u -r1.38 options.h
--- client/options.h    3 Aug 2004 00:09:44 -0000       1.38
+++ client/options.h    23 Sep 2004 00:14:32 -0000
@@ -26,6 +26,7 @@
 
 /** Local Options: **/
 
+extern bool save_options_on_exit;
 extern bool solid_color_behind_units;
 extern bool sound_bell_at_new_turn;
 extern int smooth_move_unit_msec;
Index: client/gui-gtk/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/dialogs.c,v
retrieving revision 1.146
diff -u -r1.146 dialogs.c
--- client/gui-gtk/dialogs.c    21 Sep 2004 05:00:50 -0000      1.146
+++ client/gui-gtk/dialogs.c    23 Sep 2004 00:14:33 -0000
@@ -2322,7 +2322,7 @@
   char *s;
 
   if(w == races_quit_command) {
-    exit(EXIT_SUCCESS);
+    ui_exit();
   } else if(w == races_disc_command) {
     popdown_races_dialog();
     disconnect_from_server();
Index: client/gui-gtk/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/menu.c,v
retrieving revision 1.89
diff -u -r1.89 menu.c
--- client/gui-gtk/menu.c       2 Sep 2004 04:32:51 -0000       1.89
+++ client/gui-gtk/menu.c       23 Sep 2004 00:14:33 -0000
@@ -196,7 +196,7 @@
     disconnect_from_server();
     break;
   case MENU_GAME_QUIT:
-    exit(EXIT_SUCCESS);
+    ui_exit();
   }
 }
 
Index: client/gui-gtk-2.0/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/dialogs.c,v
retrieving revision 1.73
diff -u -r1.73 dialogs.c
--- client/gui-gtk-2.0/dialogs.c        21 Sep 2004 05:00:50 -0000      1.73
+++ client/gui-gtk-2.0/dialogs.c        23 Sep 2004 00:14:33 -0000
@@ -2173,8 +2173,7 @@
     dsend_packet_nation_select_req(&aconnection, selected_nation,
                                   selected_sex, s, selected_city_style);
   } else if (response == GTK_RESPONSE_CLOSE) {
-    exit(EXIT_SUCCESS);
-
+    ui_exit();
   } else {
     popdown_races_dialog();
     disconnect_from_server();
Index: client/gui-gtk-2.0/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/menu.c,v
retrieving revision 1.40
diff -u -r1.40 menu.c
--- client/gui-gtk-2.0/menu.c   18 Sep 2004 17:47:28 -0000      1.40
+++ client/gui-gtk-2.0/menu.c   23 Sep 2004 00:14:33 -0000
@@ -215,7 +215,7 @@
     client_kill_server();
     break;
   case MENU_GAME_QUIT:
-    exit(EXIT_SUCCESS);
+    ui_exit();
   }
 }
 
Index: client/gui-win32/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/dialogs.c,v
retrieving revision 1.54
diff -u -r1.54 dialogs.c
--- client/gui-win32/dialogs.c  21 Sep 2004 05:00:51 -0000      1.54
+++ client/gui-win32/dialogs.c  23 Sep 2004 00:14:34 -0000
@@ -396,7 +396,7 @@
          }
          break;
        case ID_RACESDLG_QUIT:
-         exit(EXIT_SUCCESS);
+         ui_exit();
          break;
        case ID_RACESDLG_DISCONNECT:
          popdown_races_dialog();
Index: client/gui-win32/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/menu.c,v
retrieving revision 1.25
diff -u -r1.25 menu.c
--- client/gui-win32/menu.c     22 Sep 2004 08:38:48 -0000      1.25
+++ client/gui-win32/menu.c     23 Sep 2004 00:14:34 -0000
@@ -601,7 +601,7 @@
       client_kill_server();
       break;
     case IDM_GAME_QUIT:
-      exit(EXIT_SUCCESS);
+      ui_exit();
       break;
 
 
Index: client/gui-xaw/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/dialogs.c,v
retrieving revision 1.102
diff -u -r1.102 dialogs.c
--- client/gui-xaw/dialogs.c    21 Sep 2004 05:00:51 -0000      1.102
+++ client/gui-xaw/dialogs.c    23 Sep 2004 00:14:34 -0000
@@ -2229,7 +2229,7 @@
 void races_quit_command_callback(Widget w, XtPointer client_data, 
                                 XtPointer call_data)
 {
-  exit(EXIT_SUCCESS);
+  ui_exit();
 }
 
 /**************************************************************************

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#7255) options aren't saved by default, Jason Short <=