Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2005:
[Freeciv-Dev] (PR#13566) tab ugliness with diplomacy tab
Home

[Freeciv-Dev] (PR#13566) tab ugliness with diplomacy tab

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#13566) tab ugliness with diplomacy tab
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Sat, 30 Jul 2005 03:28:28 -0700
Reply-to: bugs@xxxxxxxxxxx

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

> [jdorje - Sat Jul 30 06:35:34 2005]:
> 
> When I use the players dialog to bring up a diplomacy window, then
> finish that meeting, the focus does not necessarily go back to the
> players dialog tab.  It goes to whatever tab happens to be next to the
> players dialog tab.  This is quite annoying as often you want to conduct
> more than one meeting in a row.
> 
> To solve this I think a "stack" of tab priorities is needed.
> 
> -jason
> 
This patch implements a concept of return_dialog - the dialog which will
be raised if our dialog is destroyed (Of course if the return dialog
still exists).

If you initiated a meeting, the diplomacy dialog will have the players
report set as its return dialog.
--
mateusz
Index: client/gui-gtk-2.0/diplodlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/diplodlg.c,v
retrieving revision 1.32
diff -u -r1.32 diplodlg.c
--- client/gui-gtk-2.0/diplodlg.c       29 Jul 2005 07:38:06 -0000      1.32
+++ client/gui-gtk-2.0/diplodlg.c       30 Jul 2005 10:22:44 -0000
@@ -38,6 +38,7 @@
 #include "gui_stuff.h"
 #include "mapview.h"
 #include "options.h"
+#include "plrdlg.h"
 
 #include "diplodlg.h"
 
@@ -183,6 +184,10 @@
   /* We initated the meeting - Make the tab active */
   if (initiated_from == game.player_ptr->player_no) {
     gui_dialog_raise(pdialog->dialog);
+    
+    if (players_dialog_shell != NULL) {
+      gui_dialog_set_return_dialog(pdialog->dialog, players_dialog_shell);
+    }
   }
 }
 
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.25
diff -u -r1.25 gui_stuff.c
--- client/gui-gtk-2.0/gui_stuff.c      16 Jul 2005 09:04:53 -0000      1.25
+++ client/gui-gtk-2.0/gui_stuff.c      30 Jul 2005 10:22:44 -0000
@@ -323,6 +323,18 @@
   }
 
   dialog_list = g_list_remove(dialog_list, dlg);
+  
+  /* Raise the return dialog set by gui_dialog_set_return_dialog() */
+  if (dlg->return_dialog_id != -1) {
+    GList *it;
+    for (it = dialog_list; it; it = g_list_next(it)) {
+      struct gui_dialog * adialog = (struct gui_dialog *)it->data;
+      if (adialog->id == dlg->return_dialog_id) {
+        gui_dialog_raise(adialog);
+       break;
+      }
+    }
+  }
   free(dlg);
 }
 
@@ -408,6 +420,7 @@
 {
   struct gui_dialog *dlg;
   GtkWidget *vbox, *action_area;
+  static int dialog_id_counter;
 
   dlg = fc_malloc(sizeof(*dlg));
   dialog_list = g_list_prepend(dialog_list, dlg);
@@ -506,6 +519,10 @@
   dlg->action_area = action_area;
 
   dlg->response_callback = gui_dialog_destroyed;
+  
+  dlg->id = dialog_id_counter;
+  dialog_id_counter++;
+  dlg->return_dialog_id = -1;
 
   g_signal_connect(vbox, "destroy",
       G_CALLBACK(gui_dialog_destroy_handler), dlg);
@@ -850,3 +867,11 @@
   dlg->response_callback = fun;
 }
 
+/**************************************************************************
+  When the dlg dialog is destroyed the return_dialog will be raised
+**************************************************************************/
+void gui_dialog_set_return_dialog(struct gui_dialog *dlg,
+                                  struct gui_dialog *return_dialog)
+{
+  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.15
diff -u -r1.15 gui_stuff.h
--- client/gui-gtk-2.0/gui_stuff.h      16 Jul 2005 09:04:53 -0000      1.15
+++ client/gui-gtk-2.0/gui_stuff.h      30 Jul 2005 10:22:57 -0000
@@ -70,6 +70,8 @@
 
   /* private. */
   enum gui_dialog_type type;
+  int id;
+  int return_dialog_id;
 
   union {
     GtkWidget *window;
@@ -110,5 +112,7 @@
 GtkWidget *gui_dialog_get_toplevel(struct gui_dialog *dlg);
 void gui_dialog_response_set_callback(struct gui_dialog *dlg,
     GUI_DIALOG_RESPONSE_FUN fun);
+void gui_dialog_set_return_dialog(struct gui_dialog *dlg,
+                                  struct gui_dialog *return_dialog);
 
 #endif  /* FC__GUI_STUFF_H */
Index: client/gui-gtk-2.0/plrdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/plrdlg.c,v
retrieving revision 1.67
diff -u -r1.67 plrdlg.c
--- client/gui-gtk-2.0/plrdlg.c 18 Jul 2005 22:46:28 -0000      1.67
+++ client/gui-gtk-2.0/plrdlg.c 30 Jul 2005 10:22:57 -0000
@@ -48,7 +48,7 @@
 
 #include "plrdlg.h"
 
-static struct gui_dialog *players_dialog_shell;
+struct gui_dialog *players_dialog_shell;
 static GtkWidget *players_list;
 static GtkTreeSelection *players_selection;
 static GtkWidget *players_int_command;
Index: client/gui-gtk-2.0/plrdlg.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/plrdlg.h,v
retrieving revision 1.7
diff -u -r1.7 plrdlg.h
--- client/gui-gtk-2.0/plrdlg.h 18 Jul 2005 22:46:28 -0000      1.7
+++ client/gui-gtk-2.0/plrdlg.h 30 Jul 2005 10:22:57 -0000
@@ -20,4 +20,5 @@
 /* Misc helper functions */
 GdkPixbuf *get_flag(const struct nation_type *pnation);
 
+extern struct gui_dialog *players_dialog_shell;
 #endif  /* FC__PLRDLG_H */

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