gnome-games r8047 - branches/gnome-2-24/glchess/src/lib/gtkui



Author: rancell
Date: Wed Oct 15 12:41:28 2008
New Revision: 8047
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8047&view=rev

Log:
Commit missing half of bug #546702

Modified:
   branches/gnome-2-24/glchess/src/lib/gtkui/gtkui.py

Modified: branches/gnome-2-24/glchess/src/lib/gtkui/gtkui.py
==============================================================================
--- branches/gnome-2-24/glchess/src/lib/gtkui/gtkui.py	(original)
+++ branches/gnome-2-24/glchess/src/lib/gtkui/gtkui.py	Wed Oct 15 12:41:28 2008
@@ -203,6 +203,8 @@
         self.feedback = feedback
         self._watches = {}
         self.__networkGames = {}
+        self.newGameDialog = None
+        self.loadGameDialog = None
         self.__saveGameDialogs = {}
         self.__joinGameDialogs = []
         
@@ -788,7 +790,10 @@
 
     def _on_new_game_button_clicked(self, widget):
         """Gtk+ callback"""
-        dialogs.GtkNewGameDialog(self, self.__playerModel)
+        if self.newGameDialog:
+            self.newGameDialog.window.present()
+        else:
+            self.newGameDialog = dialogs.GtkNewGameDialog(self, self.__playerModel)
 
     def _on_join_game_button_clicked(self, widget):
         """Gtk+ callback"""
@@ -796,19 +801,30 @@
 
     def _on_open_game_button_clicked(self, widget):
         """Gtk+ callback"""
-        dialogs.GtkLoadGameDialog(self)
+        if self.loadGameDialog:
+            self.loadGameDialog.window.present()
+        else:
+            self.loadGameDialog = dialogs.GtkLoadGameDialog(self)
         
     def _on_save_game_button_clicked(self, widget):
         """Gtk+ callback"""
         if self.view.feedback.getFileName() is not None:
             self.view.feedback.save()
-        elif not self.__saveGameDialogs.has_key(self.view):
-            self.__saveGameDialogs[self.view] = dialogs.GtkSaveGameDialog(self, self.view)
-            
+            return
+        
+        try:
+            dialog = self.__saveGameDialogs[self.view]
+        except KeyError:
+            dialog = self.__saveGameDialogs[self.view] = dialogs.GtkSaveGameDialog(self, self.view)
+        dialog.window.present()
+
     def _on_save_as_game_button_clicked(self, widget):
         """Gtk+ callback"""
-        if not self.__saveGameDialogs.has_key(self.view):
-            self.__saveGameDialogs[self.view] = dialogs.GtkSaveGameDialog(self, self.view, self.view.feedback.getFileName())
+        try:
+            dialog = self.__saveGameDialogs[self.view]
+        except KeyError:
+            dialog = self.__saveGameDialogs[self.view] = dialogs.GtkSaveGameDialog(self, self.view, self.view.feedback.getFileName())
+        dialog.window.present()
 
     def _on_resign_clicked(self, widget):
         """Gtk+ callback"""



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]