tDisable the Metaserver Connect button when no server is selected from the list. - vaccinewars - be a doctor and try to vaccinate the world
git clone git://src.adamsgaard.dk/vaccinewars
Log
Files
Refs
README
LICENSE
---
commit fdfb74e2a12fcd210e0de6787e7ec1efb4e29f46
parent a2c5b5500aed221db5a5aa03bfa43b902be20315
Author: Ben Webb 
Date:   Mon,  2 Sep 2002 13:39:22 +0000

Disable the Metaserver Connect button when no server is selected from the list.


Diffstat:
  M src/gui_client/newgamedia.c         |      17 +++++++++++++++++

1 file changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/gui_client/newgamedia.c b/src/gui_client/newgamedia.c
t@@ -430,6 +430,18 @@ static void CloseNewGameDia(GtkWidget *widget, gpointer data)
   NewGameType = gtk_notebook_get_current_page(GTK_NOTEBOOK(stgam.notebook));
 }
 
+static void metalist_row_select(GtkWidget *clist, gint row, gint column,
+                                GdkEvent *event, GtkWidget *conn_button)
+{
+  gtk_widget_set_sensitive(conn_button, TRUE);
+}
+
+static void metalist_row_unselect(GtkWidget *clist, gint row, gint column,
+                                  GdkEvent *event, GtkWidget *conn_button)
+{
+  gtk_widget_set_sensitive(conn_button, FALSE);
+}
+
 #ifdef NETWORKING
 void NewGameDialog(Player *play, NBCallBack sockstat)
 #else
t@@ -606,6 +618,11 @@ void NewGameDialog(Player *play)
   SetAccelerator(button, _("_Connect"), button, "clicked", accel_group, TRUE);
   gtk_signal_connect(GTK_OBJECT(button), "clicked",
                      GTK_SIGNAL_FUNC(MetaServerConnect), NULL);
+  gtk_widget_set_sensitive(button, FALSE);
+  gtk_signal_connect(GTK_OBJECT(clist), "select_row",
+                     GTK_SIGNAL_FUNC(metalist_row_select), button);
+  gtk_signal_connect(GTK_OBJECT(clist), "unselect_row",
+                     GTK_SIGNAL_FUNC(metalist_row_unselect), button);
   gtk_box_pack_start_defaults(GTK_BOX(hbbox), button);
 
   gtk_box_pack_start(GTK_BOX(vbox2), hbbox, FALSE, FALSE, 0);