Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2004:
[Freeciv-Dev] (PR#8558) CLIENT_CAN_LAUNCH_SERVER macro
Home

[Freeciv-Dev] (PR#8558) CLIENT_CAN_LAUNCH_SERVER macro

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8558) CLIENT_CAN_LAUNCH_SERVER macro
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 20 Apr 2004 16:04:26 -0700
Reply-to: rt@xxxxxxxxxxx

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

This patch adds a CLIENT_CAN_LAUNCH_SERVER macro definition to 
connectdlg_common.h.  This macro should be used for several purposes.

Firstly if it's not defined the the GUI needs to behave a little 
differently.  For instance if you go into config.h now and undefine 
HAVE_WORKING_FORK (as if you were building gui-gtk-2 for win32), then 
recompile the gtk2 client you'll get a client that misbehaves a bit. 
Using this macro the client can instead disable the server-launching 
options so that the interface is a bit better (though not ideal).

Secondly it can be used internally in connectdlg_common.c.  Currently 
the only way for the client to launch the server is through fork. 
However in the future a win32_native method will be used as an 
alternative.  In this case there is some common code (like the second 
half of client_start_server()) that should be enabled depending on 
CLIENT_CAN_LAUNCH_SERVER.

jason

? cma_weirdness
? diff
? data/civ3
? data/womoks
Index: client/connectdlg_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/connectdlg_common.h,v
retrieving revision 1.1
diff -u -r1.1 connectdlg_common.h
--- client/connectdlg_common.h  10 Apr 2004 03:47:48 -0000      1.1
+++ client/connectdlg_common.h  20 Apr 2004 22:58:05 -0000
@@ -15,6 +15,10 @@
 
 #include "shared.h"
 
+#if defined HAVE_WORKING_FORK
+# define CLIENT_CAN_LAUNCH_SERVER
+#endif
+
 bool client_start_server(void);
 void client_kill_server(void);
 bool is_server_running(void);
Index: client/gui-gtk-2.0/connectdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/connectdlg.c,v
retrieving revision 1.31
diff -u -r1.31 connectdlg.c
--- client/gui-gtk-2.0/connectdlg.c     12 Apr 2004 14:17:36 -0000      1.31
+++ client/gui-gtk-2.0/connectdlg.c     20 Apr 2004 22:58:05 -0000
@@ -747,7 +747,11 @@
     return;
   }
 
+#ifdef CLIENT_CAN_LAUNCH_SERVER
   next_page = NEW_PAGE;
+#else
+  next_page = NETWORK_PAGE;
+#endif
   dialog_config = LOGIN_TYPE;
 
   dialog = gtk_dialog_new_with_buttons(_(" Connect to Freeciv Server"),
@@ -797,6 +801,7 @@
   vbox = gtk_vbox_new(FALSE, 2);
   gtk_notebook_append_page(GTK_NOTEBOOK(uberbook), vbox, NULL);
 
+#ifdef CLIENT_CAN_LAUNCH_SERVER
   radio = gtk_radio_button_new_with_mnemonic(group, _("_Start New Game"));
   group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radio));
   gtk_box_pack_start(GTK_BOX(vbox), radio, TRUE, FALSE, 2);
@@ -810,6 +815,7 @@
   
   g_signal_connect(radio, "toggled",G_CALLBACK(radio_command_callback),
                    GINT_TO_POINTER(LOAD_PAGE));
+#endif
 
   radio = gtk_radio_button_new_with_mnemonic(group,
                                             _("_Connect to Network Game"));

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#8558) CLIENT_CAN_LAUNCH_SERVER macro, Jason Short <=