Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2002:
[Freeciv-Dev] Re: [Patch] Fix for (PR#533)
Home

[Freeciv-Dev] Re: [Patch] Fix for (PR#533)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Raimar Falke <rf13@xxxxxxxxxxxxxxxxx>
Cc: Gaute B Strokkenes <gs234@xxxxxxxxx>, freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: [Patch] Fix for (PR#533)
From: Andreas Kemnade <akemnade@xxxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 24 Jul 2002 14:09:29 +0200

Raimar Falke writes:
 > On Wed, Jul 17, 2002 at 03:25:14PM +0200, Gaute B Strokkenes wrote:
 > > On Tue, 16 Jul 2002, rf13@xxxxxxxxxxxxxxxxx wrote:
 > > > On Tue, Mar 19, 2002 at 09:00:07PM +0100, Raimar Falke wrote:
 > > >> 
 > > >> The attached patch should fix the issue of open/533. I'm not sure
 > > >> if I got all dialogs but the biggest ones.
 > > >> 
 > > >> Andreas: can you provide an updated version of the patch for win?
 > > >> Vasco: can you do the same for GTK2.0?
 > > > 
 > > > Updated version attached. Still only the GTK client.
 > > 
 > > I don't see it.
updated gtk client again

This patch handles the win32 and the gtk client (both tested)
I had to change things in civclient.c because the win32 client can
open more than one notify dialog. 

Greetings
Andreas Kemnade

Index: client/civclient.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/civclient.c,v
retrieving revision 1.141
diff -u -r1.141 civclient.c
--- client/civclient.c  2002/07/23 02:48:45     1.141
+++ client/civclient.c  2002/07/24 11:57:44
@@ -45,6 +45,7 @@
 
 #include "chatline_g.h"
 #include "citydlg_g.h"
+#include "cityrep_g.h"
 #include "climisc.h"
 #include "clinet.h"
 #include "connectdlg_g.h"
@@ -584,6 +585,7 @@
     }
     else if(client_state==CLIENT_PRE_GAME_STATE) {
       popdown_all_city_dialogs();
+      popdown_everything();
       close_all_diplomacy_dialogs();
       client_remove_all_cli_conn();
       set_unit_focus_no_center(NULL);
Index: client/gui-gtk/cityrep.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/cityrep.c,v
retrieving revision 1.61
diff -u -r1.61 cityrep.c
--- client/gui-gtk/cityrep.c    2002/07/24 10:41:55     1.61
+++ client/gui-gtk/cityrep.c    2002/07/24 11:57:47
@@ -162,6 +162,19 @@
    }
 }
 
+/****************************************************************
+...
+****************************************************************/
+void popdown_city_report_dialog()
+{
+  if (city_dialog_shell) {
+    if (city_dialog_shell_is_modal) {
+      gtk_widget_set_sensitive(top_vbox, TRUE);
+    }
+    gtk_widget_destroy(city_dialog_shell);
+    city_dialog_shell = NULL;
+  }
+}
 
 /****************************************************************
 ...
@@ -1148,11 +1161,7 @@
 *****************************************************************/
 static void city_close_callback(GtkWidget *w, gpointer data)
 {
-
-  if(city_dialog_shell_is_modal)
-     gtk_widget_set_sensitive(top_vbox, TRUE);
-   gtk_widget_destroy(city_dialog_shell);
-   city_dialog_shell=NULL;
+  popdown_city_report_dialog();
 }
 
 /****************************************************************
Index: client/gui-gtk/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/dialogs.c,v
retrieving revision 1.103
diff -u -r1.103 dialogs.c
--- client/gui-gtk/dialogs.c    2002/06/24 15:56:39     1.103
+++ client/gui-gtk/dialogs.c    2002/07/24 11:57:52
@@ -69,6 +69,8 @@
                                              as the races_dialog is
                                              poped up. */
 /******************************************************************/
+static GtkWidget  *notify_dialog_shell;
+/******************************************************************/
 static GtkWidget  *spy_tech_shell;
 static GtkWidget  *spy_advances_list;
 static GtkWidget  *spy_steal_command;
@@ -141,10 +143,9 @@
 /****************************************************************
 ...
 *****************************************************************/
-static void notify_command_callback(GtkWidget *w, GtkWidget *t)
+static void notify_command_callback(GtkWidget * w, GtkWidget * t)
 {
-  gtk_widget_destroy( t );
-  gtk_widget_set_sensitive( top_vbox, TRUE );
+  popdown_notify_dialog();
 }
 
 /****************************************************************
@@ -162,7 +163,7 @@
 *****************************************************************/
 void popup_notify_dialog(char *caption, char *headline, char *lines)
 {
-  GtkWidget *notify_dialog_shell, *notify_command;
+  GtkWidget *notify_command;
   GtkWidget *notify_label, *notify_headline, *notify_scrolled;
   GtkAccelGroup *accel=gtk_accel_group_new();
   
@@ -221,6 +222,18 @@
   gtk_widget_show( notify_dialog_shell );
 
   gtk_widget_set_sensitive( top_vbox, FALSE );
+}
+
+/****************************************************************
+...
+*****************************************************************/
+void popdown_notify_dialog()
+{
+  if (notify_dialog_shell) {
+    gtk_widget_destroy(notify_dialog_shell);
+    gtk_widget_set_sensitive(top_vbox, TRUE);
+    notify_dialog_shell = NULL;
+  }
 }
 
 /****************************************************************
Index: client/gui-gtk/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/gui_main.c,v
retrieving revision 1.112
diff -u -r1.112 gui_main.c
--- client/gui-gtk/gui_main.c   2002/07/18 09:14:45     1.112
+++ client/gui-gtk/gui_main.c   2002/07/24 11:57:54
@@ -184,6 +184,20 @@
 }
 
 /**************************************************************************
+  This pops down every dialog
+**************************************************************************/
+void popdown_everything(void)
+{
+  popdown_city_report_dialog();
+  popdown_meswin_dialog();
+  popdown_science_dialog();
+  popdown_economy_report_dialog();
+  popdown_activeunits_report_dialog();
+  popdown_players_dialog();
+  popdown_notify_dialog();
+}
+
+/**************************************************************************
  handles main window keyboard events.
 **************************************************************************/
 static gint keyboard_handler(GtkWidget *w, GdkEventKey *ev)
Index: client/gui-gtk/messagewin.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/messagewin.c,v
retrieving revision 1.34
diff -u -r1.34 messagewin.c
--- client/gui-gtk/messagewin.c 2002/07/24 10:41:56     1.34
+++ client/gui-gtk/messagewin.c 2002/07/24 11:57:55
@@ -85,6 +85,18 @@
 {
   return meswin_dialog_shell != NULL;
 }
+/**************************************************************************
+  ...
+**************************************************************************/
+void popdown_meswin_dialog()
+{
+  if (meswin_dialog_shell) {
+    gtk_widget_destroy(meswin_dialog_shell);
+    meswin_dialog_shell = NULL;
+    gtk_style_unref(meswin_visited_style);
+    gtk_style_unref(meswin_not_visited_style);
+  }
+}
 
 /****************************************************************
 ...
@@ -265,10 +277,7 @@
 **************************************************************************/
 static void meswin_close_callback(GtkWidget *w, gpointer data)
 {
-  gtk_widget_destroy(meswin_dialog_shell);
-  meswin_dialog_shell = NULL;
-  gtk_style_unref(meswin_visited_style);
-  gtk_style_unref(meswin_not_visited_style);
+  popdown_meswin_dialog();
 }
 
 /**************************************************************************
Index: client/gui-gtk/plrdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/plrdlg.c,v
retrieving revision 1.35
diff -u -r1.35 plrdlg.c
--- client/gui-gtk/plrdlg.c     2002/06/27 00:59:14     1.35
+++ client/gui-gtk/plrdlg.c     2002/07/24 11:57:56
@@ -86,6 +86,17 @@
   }
 }
 
+/****************************************************************
+ ...
+*****************************************************************/
+void popdown_players_dialog(void)
+{
+  if (players_dialog_shell) {
+    gtk_widget_destroy(players_dialog_shell);
+    players_dialog_shell = NULL;
+  }
+}
+
 /*
  * Sort plrs by column...
  */
@@ -498,10 +509,9 @@
 /**************************************************************************
 ...
 **************************************************************************/
-void players_button_callback(GtkWidget *w, gpointer data)
+static void players_button_callback(GtkWidget * w, gpointer data)
 {
-  gtk_widget_destroy(players_dialog_shell);
-  players_dialog_shell = NULL;
+  popdown_players_dialog();
 }
 
 /**************************************************************************
Index: client/gui-gtk/repodlgs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/repodlgs.c,v
retrieving revision 1.61
diff -u -r1.61 repodlgs.c
--- client/gui-gtk/repodlgs.c   2002/06/27 00:59:15     1.61
+++ client/gui-gtk/repodlgs.c   2002/07/24 11:57:58
@@ -119,6 +119,19 @@
   }
 }
 
+/****************************************************************
+...
+*****************************************************************/
+void popdown_science_dialog()
+{
+  if (science_dialog_shell) {
+    if (science_dialog_shell_is_modal) {
+      gtk_widget_set_sensitive(top_vbox, TRUE);
+    }
+    gtk_widget_destroy(science_dialog_shell);
+    science_dialog_shell = NULL;
+  }
+}
 
 /****************************************************************
 ...
@@ -282,13 +295,9 @@
 /****************************************************************
 ...
 *****************************************************************/
-void science_close_callback(GtkWidget *widget, gpointer data)
+static void science_close_callback(GtkWidget * widget, gpointer data)
 {
-
-  if(science_dialog_shell_is_modal)
-    gtk_widget_set_sensitive(top_vbox, TRUE);
-  gtk_widget_destroy(science_dialog_shell);
-  science_dialog_shell=NULL;
+  popdown_science_dialog();
 }
 
 /****************************************************************
@@ -535,6 +544,19 @@
    }
 }
 
+/****************************************************************
+...
+****************************************************************/
+void popdown_economy_report_dialog()
+{
+  if (economy_dialog_shell) {
+    if (economy_dialog_shell_is_modal) {
+      gtk_widget_set_sensitive(top_vbox, TRUE);
+    }
+    gtk_widget_destroy(economy_dialog_shell);
+    economy_dialog_shell = NULL;
+  }
+}
 
 /****************************************************************
 ...
@@ -642,13 +664,9 @@
 /****************************************************************
 ...
 *****************************************************************/
-void economy_close_callback(GtkWidget *w, gpointer data)
+static void economy_close_callback(GtkWidget * w, gpointer data)
 {
-
-  if(economy_dialog_shell_is_modal)
-     gtk_widget_set_sensitive(top_vbox, TRUE);
-  gtk_widget_destroy(economy_dialog_shell);
-  economy_dialog_shell=NULL;
+  popdown_economy_report_dialog();
 }
 
 /****************************************************************
@@ -769,6 +787,19 @@
    }
 }
 
+/****************************************************************
+...
+****************************************************************/
+void popdown_activeunits_report_dialog()
+{
+  if (activeunits_dialog_shell) {
+    if (activeunits_dialog_shell_is_modal) {
+      gtk_widget_set_sensitive(top_vbox, TRUE);
+    }
+    gtk_widget_destroy(activeunits_dialog_shell);
+    activeunits_dialog_shell = NULL;
+  }
+}
 
 /****************************************************************
 ...
@@ -914,13 +945,9 @@
 /****************************************************************
 ...
 *****************************************************************/
-void activeunits_close_callback(GtkWidget *w, gpointer data)
+static void activeunits_close_callback(GtkWidget * w, gpointer data)
 {
-
-  if(activeunits_dialog_shell_is_modal)
-     gtk_widget_set_sensitive(top_vbox, TRUE);
-  gtk_widget_destroy(activeunits_dialog_shell);
-  activeunits_dialog_shell = NULL;
+  popdown_activeunits_report_dialog();
 }
 
 /****************************************************************
Index: client/include/cityrep_g.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/include/cityrep_g.h,v
retrieving revision 1.4
diff -u -r1.4 cityrep_g.h
--- client/include/cityrep_g.h  2002/04/12 13:50:55     1.4
+++ client/include/cityrep_g.h  2002/07/24 11:57:59
@@ -18,6 +18,7 @@
 struct city;
 
 void popup_city_report_dialog(bool make_modal);
+void popdown_city_report_dialog(void);
 void city_report_dialog_update(void);
 void city_report_dialog_update_city(struct city *pcity);
 
Index: client/include/dialogs_g.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/include/dialogs_g.h,v
retrieving revision 1.11
diff -u -r1.11 dialogs_g.h
--- client/include/dialogs_g.h  2002/05/25 15:05:58     1.11
+++ client/include/dialogs_g.h  2002/07/24 11:57:59
@@ -23,6 +23,7 @@
 
 void popup_notify_goto_dialog(char *headline, char *lines, int x, int y);
 void popup_notify_dialog(char *caption, char *headline, char *lines);
+void popdown_notify_dialog(void);
 
 void popup_races_dialog(void);
 void popdown_races_dialog(void);
Index: client/include/gui_main_g.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/include/gui_main_g.h,v
retrieving revision 1.7
diff -u -r1.7 gui_main_g.h
--- client/include/gui_main_g.h 2002/06/27 01:11:42     1.7
+++ client/include/gui_main_g.h 2002/07/24 11:57:59
@@ -27,6 +27,8 @@
 void set_unit_icon(int idx, struct unit *punit);
 void set_unit_icons_more_arrow(bool onoff);
 
+void popdown_everything(void);
+
 extern const char *client_string;
 
 #endif  /* FC__GUI_MAIN_G_H */
Index: client/include/messagewin_g.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/include/messagewin_g.h,v
retrieving revision 1.3
diff -u -r1.3 messagewin_g.h
--- client/include/messagewin_g.h       2002/07/18 09:42:29     1.3
+++ client/include/messagewin_g.h       2002/07/24 11:57:59
@@ -18,6 +18,7 @@
 #include "messagewin_common.h"
 
 void popup_meswin_dialog(void);
+void popdown_meswin_dialog(void);
 bool is_meswin_open(void);
 void real_update_meswin_dialog(void);
      
Index: client/include/plrdlg_g.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/include/plrdlg_g.h,v
retrieving revision 1.3
diff -u -r1.3 plrdlg_g.h
--- client/include/plrdlg_g.h   2002/06/27 00:59:21     1.3
+++ client/include/plrdlg_g.h   2002/07/24 11:57:59
@@ -16,6 +16,7 @@
 #include "plrdlg_common.h"
 
 void popup_players_dialog(void);
+void popdown_players_dialog(void);
 void update_players_dialog(void);
 
 #endif  /* FC__PLRDLG_G_H */
Index: client/include/repodlgs_g.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/include/repodlgs_g.h,v
retrieving revision 1.5
diff -u -r1.5 repodlgs_g.h
--- client/include/repodlgs_g.h 2002/06/27 00:59:21     1.5
+++ client/include/repodlgs_g.h 2002/07/24 11:57:59
@@ -22,9 +22,14 @@
 
 void science_dialog_update(void);
 void popup_science_dialog(bool make_modal);
+void popdown_science_dialog(void);
+
 void economy_report_dialog_update(void);
 void popup_economy_report_dialog(bool make_modal);
+void popdown_economy_report_dialog(void);
+
 void activeunits_report_dialog_update(void);
 void popup_activeunits_report_dialog(bool make_modal);
+void popdown_activeunits_report_dialog(void);
 
 #endif  /* FC__REPODLGS_G_H */




[Prev in Thread] Current Thread [Next in Thread]