[gnome-chess] Open save dialog rather than autosaving on new game prompt



commit d24f5f1a9d1a940d7ab5299646238abc75dfbd9d
Author: Michael Catanzaro <mike catanzaro gmail com>
Date:   Sun Jun 23 09:59:49 2013 -0500

    Open save dialog rather than autosaving on new game prompt
    
    Saying that you want to save the game, then not getting any save prompt,
    is confusing and unexpected. The user should never have any choice in
    autosaving anyway; by definition that's something that should happen
    without his input.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=702157

 src/gnome-chess.vala |   19 ++++++++-----------
 1 files changed, 8 insertions(+), 11 deletions(-)
---
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index 35092b8..98bd971 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -1032,18 +1032,15 @@ public class Application : Gtk.Application
 
             var result = dialog.run ();
             dialog.destroy ();
+
             if (result == Gtk.ResponseType.CANCEL)
                 return;
-
-            if (result == Gtk.ResponseType.NO)
-            {
-                in_history = false;
-                game_needs_saving = false;
-            }
+            else if (result == Gtk.ResponseType.YES)
+                save_game (Gtk.Stock.DISCARD, Gtk.Stock.SAVE); /* Your very last chance to save */
+            else
+                assert (result == Gtk.ResponseType.NO);
         }
 
-        autosave ();
-
         start_new_game ();
     }
 
@@ -1605,7 +1602,7 @@ public class Application : Gtk.Application
         dialog.add (vbox);
     }
     
-    private void save_game ()
+    private void save_game (string cancel_button_label = Gtk.Stock.CANCEL, string save_button_label = 
Gtk.Stock.SAVE)
     {
         /* Show active dialog */
         if (save_dialog != null)
@@ -1617,8 +1614,8 @@ public class Application : Gtk.Application
         save_dialog = new Gtk.FileChooserDialog (/* Title of save game dialog */
                                                  _("Save Chess Game"),
                                                  window, Gtk.FileChooserAction.SAVE,
-                                                 Gtk.Stock.CANCEL, Gtk.ResponseType.CANCEL,
-                                                 Gtk.Stock.SAVE, Gtk.ResponseType.OK, null);
+                                                 cancel_button_label, Gtk.ResponseType.CANCEL,
+                                                 save_button_label, Gtk.ResponseType.OK, null);
         add_info_bar_to_dialog (save_dialog, out save_dialog_info_bar, out save_dialog_error_label);
 
         save_dialog.file_activated.connect (save_file_cb);        


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