tMore tweaks to GTK+ New Game dialog; now understands ServerName=(Prompt) etc. - vaccinewars - be a doctor and try to vaccinate the world
 (HTM) git clone git://src.adamsgaard.dk/vaccinewars
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 93331be9af913e2a14cdf0c878fef43c2cd549af
 (DIR) parent 2a470e2fc73fd94ceb29647b965239a69db7a589
 (HTM) Author: Ben Webb <ben@salilab.org>
       Date:   Tue,  3 Apr 2001 00:29:00 +0000
       
       More tweaks to GTK+ New Game dialog; now understands ServerName=(Prompt) etc.
       
       
       Diffstat:
         M src/curses_client.c                 |       6 +++---
         M src/dopewars.h                      |       5 +++++
         M src/gtk_client.c                    |      24 +++++++++++++++++++++---
       
       3 files changed, 29 insertions(+), 6 deletions(-)
       ---
 (DIR) diff --git a/src/curses_client.c b/src/curses_client.c
       t@@ -289,14 +289,14 @@ static char ConnectToServer(Player *Play) {
           char *pt=NULL,*MetaError=NULL;
           gchar *text;
           int c;
       -   if (strcasecmp(ServerName,"(MetaServer)")==0 || ConnectMethod==CM_META) {
       +   if (strcasecmp(ServerName,SN_META)==0 || ConnectMethod==CM_META) {
              ConnectMethod=CM_META;
              MetaError=SelectServerFromMetaServer();
       -   } else if (strcasecmp(ServerName,"(Prompt)")==0 ||
       +   } else if (strcasecmp(ServerName,SN_PROMPT)==0 ||
                      ConnectMethod==CM_PROMPT) {
              ConnectMethod=CM_PROMPT;
              SelectServerManually();
       -   } else if (strcasecmp(ServerName,"(Single)")==0 ||
       +   } else if (strcasecmp(ServerName,SN_SINGLE)==0 ||
                      ConnectMethod==CM_SINGLE) {
              ConnectMethod=CM_SINGLE;
              return TRUE;
 (DIR) diff --git a/src/dopewars.h b/src/dopewars.h
       t@@ -304,6 +304,11 @@ struct PLAYER_T {
        #define CM_PROMPT 1
        #define CM_META   2
        #define CM_SINGLE 3
       +
       +#define SN_PROMPT "(Prompt)"
       +#define SN_META   "(MetaServer)"
       +#define SN_SINGLE "(Single)"
       +
        typedef struct tag_serverdata {
           char *Name;
           int Port;
 (DIR) diff --git a/src/gtk_client.c b/src/gtk_client.c
       t@@ -62,6 +62,9 @@
        #define ET_SPY    0
        #define ET_TIPOFF 1
        
       +/* Which notebook page to display in the New Game dialog */
       +static gint NewGameType=0;
       +
        struct InventoryWidgets {
           GtkWidget *HereList,*CarriedList;
           GtkWidget *HereFrame,*CarriedFrame;
       t@@ -1823,9 +1826,10 @@ void NewGameDialog() {
           GtkWidget *table,*clist,*scrollwin,*dialog,*hbbox;
           GtkAccelGroup *accel_group;
           gchar *text;
       -   gchar *server_titles[5];
       +   gchar *server_titles[5],*ServerEntry;
           static struct StartGameStruct widgets;
           guint AccelKey;
       +   gboolean UpdateMeta=FALSE;
        
           server_titles[0]=_("Server");
           server_titles[1]=_("Port");
       t@@ -1880,7 +1884,16 @@ void NewGameDialog() {
           gtk_table_attach(GTK_TABLE(table),label,0,1,0,1,
                            GTK_SHRINK,GTK_SHRINK,0,0);
           entry=widgets.hostname=gtk_entry_new();
       -   gtk_entry_set_text(GTK_ENTRY(entry),ServerName);
       +
       +   ServerEntry = "localhost";
       +   if (strcasecmp(ServerName,SN_META)==0) {
       +      NewGameType=2;
       +      UpdateMeta=TRUE;
       +   } else if (strcasecmp(ServerName,SN_PROMPT)==0) NewGameType=0;
       +   else if (strcasecmp(ServerName,SN_SINGLE)==0)   NewGameType=1;
       +   else ServerEntry = ServerName;
       +
       +   gtk_entry_set_text(GTK_ENTRY(entry),ServerEntry);
           gtk_table_attach(GTK_TABLE(table),entry,1,2,0,1,
                            GTK_EXPAND|GTK_SHRINK|GTK_FILL,
                            GTK_EXPAND|GTK_SHRINK|GTK_FILL,0,0);
       t@@ -1973,9 +1986,14 @@ void NewGameDialog() {
           gtk_container_add(GTK_CONTAINER(widgets.dialog),vbox);
        
           gtk_widget_grab_focus(widgets.name);
       -   FillMetaServerList(&widgets);
       +   if (UpdateMeta) {
       +      UpdateMetaServerList(NULL,&widgets);
       +   } else {
       +      FillMetaServerList(&widgets);
       +   }
        
           gtk_widget_show_all(widgets.dialog);
       +   gtk_notebook_set_page(GTK_NOTEBOOK(notebook),NewGameType);
        }
        
        #ifndef CYGWIN