Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2005:
[Freeciv-Dev] (PR#13886) bizarre behavior when closing tab
Home

[Freeciv-Dev] (PR#13886) bizarre behavior when closing tab

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#13886) bizarre behavior when closing tab
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Tue, 6 Sep 2005 06:32:25 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13886 >

This patch does the trick.
--
mateusz
Index: client/gui-gtk-2.0/gui_stuff.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_stuff.c,v
retrieving revision 1.26
diff -u -r1.26 gui_stuff.c
--- client/gui-gtk-2.0/gui_stuff.c      1 Aug 2005 06:44:44 -0000       1.26
+++ client/gui-gtk-2.0/gui_stuff.c      6 Sep 2005 13:30:45 -0000
@@ -362,6 +362,16 @@
 **************************************************************************/
 static gint gui_dialog_delete_tab_handler(struct gui_dialog* dlg)
 {
+  GtkWidget* notebook;
+  int n;
+  
+  notebook = dlg->v.tab.notebook;
+  n = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
+  if (gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), n)
+      != dlg->v.tab.child) {
+    gui_dialog_set_return_dialog(dlg, NULL);
+  }                                                      
+  
   /* emit response signal. */
   gui_dialog_response(dlg, GTK_RESPONSE_DELETE_EVENT);
                                                                                
@@ -508,6 +518,7 @@
       dlg->v.tab.handler_id =
        g_signal_connect(notebook, "switch_page",
            G_CALLBACK(gui_dialog_switch_page_handler), dlg);
+      dlg->v.tab.child = vbox;
 
       dlg->v.tab.label = label;
       dlg->v.tab.notebook = GTK_WIDGET(notebook);
@@ -873,5 +884,9 @@
 void gui_dialog_set_return_dialog(struct gui_dialog *dlg,
                                   struct gui_dialog *return_dialog)
 {
-  dlg->return_dialog_id = return_dialog->id;
+  if (return_dialog == NULL) {
+    dlg->return_dialog_id = -1;
+  } else {
+    dlg->return_dialog_id = return_dialog->id;
+  }
 }
Index: client/gui-gtk-2.0/gui_stuff.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_stuff.h,v
retrieving revision 1.16
diff -u -r1.16 gui_stuff.h
--- client/gui-gtk-2.0/gui_stuff.h      1 Aug 2005 06:44:44 -0000       1.16
+++ client/gui-gtk-2.0/gui_stuff.h      6 Sep 2005 13:30:45 -0000
@@ -79,6 +79,7 @@
       GtkWidget *label;
       GtkWidget *notebook;
       gulong handler_id;
+      GtkWidget *child;
     } tab;
   } v;
 

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