Index: client/gui-gtk/citydlg.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/citydlg.c,v retrieving revision 1.63 diff -u -r1.63 citydlg.c --- citydlg.c 2001/01/23 19:19:50 1.63 +++ citydlg.c 2001/01/23 19:36:34 @@ -92,7 +92,7 @@ GtkWidget *change_shell, *change_list; GtkWidget *rename_input; GtkWidget *worklist_shell; - GtkWidget *buy_shell, *sell_shell; + GtkWidget *buy_shell, *sell_shell, *rename_shell; Impr_Type_id sell_id; @@ -472,6 +472,7 @@ pdialog->buy_shell = NULL; pdialog->sell_shell = NULL; + pdialog->rename_shell = NULL; pdialog->improvement_list=gtk_clist_new(1); gtk_clist_set_column_width(GTK_CLIST(pdialog->improvement_list), 0, @@ -950,14 +951,16 @@ *****************************************************************/ static void rename_city_callback(GtkWidget *w, gpointer data) { - struct city_dialog *pdialog; + struct city_dialog *pdialog = (struct city_dialog *)data; struct packet_city_request packet; - if((pdialog=(struct city_dialog *)data)) { + if (pdialog) { packet.city_id=pdialog->pcity->id; packet.worklist.name[0] = '\0'; sz_strlcpy(packet.name, input_dialog_get_input(w)); send_packet_city_request(&aconnection, &packet, PACKET_CITY_RENAME); + + pdialog->rename_shell = NULL; } input_dialog_destroy(w); @@ -966,18 +969,34 @@ /**************************************************************** ... *****************************************************************/ +static gint rename_callback_delete(GtkWidget *widget, GdkEvent *event, + gpointer data) +{ + struct city_dialog *pdialog = (struct city_dialog *)data; + pdialog->rename_shell = NULL; + return FALSE; +} + +/**************************************************************** +... +*****************************************************************/ void rename_callback(GtkWidget *w, gpointer data) { struct city_dialog *pdialog; pdialog=(struct city_dialog *)data; + + pdialog->rename_shell = + input_dialog_create(pdialog->shell, + /*"shellrenamecity"*/_("Rename City"), + _("What should we rename the city to?"), + pdialog->pcity->name, + (void*)rename_city_callback, (gpointer)pdialog, + (void*)rename_city_callback, (gpointer)0); - input_dialog_create(pdialog->shell, - /*"shellrenamecity"*/_("Rename City"), - _("What should we rename the city to?"), - pdialog->pcity->name, - (void*)rename_city_callback, (gpointer)pdialog, - (void*)rename_city_callback, (gpointer)0); + gtk_signal_connect(GTK_OBJECT(pdialog->rename_shell), "delete_event", + GTK_SIGNAL_FUNC(rename_callback_delete), + data); } /**************************************************************** @@ -2233,6 +2252,8 @@ gtk_widget_destroy(pdialog->buy_shell); if (pdialog->sell_shell) gtk_widget_destroy(pdialog->sell_shell); + if (pdialog->rename_shell) + gtk_widget_destroy(pdialog->rename_shell); unit_list_iterate(pdialog->pcity->info_units_supported, psunit) { free(psunit);