[gnome-sudoku/gnome-3-16: 1/14] Rework the well done dialog



commit f919977d43aa1ed4084cf69c51bf1dc3379688a7
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sat Sep 6 15:17:43 2014 -0500

    Rework the well done dialog
    
    The buttons should be actions, and sudoku is a long enough game that
    there's not much value in letting players skip the one-click new game
    screen. And the dialog should be modal.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=736208

 src/gnome-sudoku.vala |   21 ++++++++-------------
 1 files changed, 8 insertions(+), 13 deletions(-)
---
diff --git a/src/gnome-sudoku.vala b/src/gnome-sudoku.vala
index ad3e6fc..f08065a 100644
--- a/src/gnome-sudoku.vala
+++ b/src/gnome-sudoku.vala
@@ -294,24 +294,19 @@ public class Sudoku : Gtk.Application
 
             /* Text in dialog that displays when the game is over. */
             var minutes = int.max (1, (int) game.get_total_time_played () / 60);
-            var time_str = ngettext ("Well done, you completed the puzzle in %d minute",
-                                     "Well done, you completed the puzzle in %d minutes",
+            var time_str = ngettext ("Well done, you completed the puzzle in %d minute!",
+                                     "Well done, you completed the puzzle in %d minutes!",
                                      minutes).printf (minutes);
             var dialog = new MessageDialog (window, DialogFlags.DESTROY_WITH_PARENT, MessageType.INFO, 
ButtonsType.NONE, time_str);
 
-            dialog.add_button (_("Same difficulty again"), 0);
-            dialog.add_button (_("New difficulty"), 1);
+            dialog.add_button (_("Play _Again"), Gtk.ResponseType.ACCEPT);
+            dialog.add_button (_("_Quit"), Gtk.ResponseType.REJECT);
 
             dialog.response.connect ((response_id) => {
-                switch (response_id)
-                {
-                    case 0:
-                        start_game (SudokuGenerator.generate_board (board.difficulty_category));
-                        break;
-                    case 1:
-                        show_new_game_screen ();
-                        break;
-                }
+                if (response_id == Gtk.ResponseType.ACCEPT)
+                    show_new_game_screen ();
+                else if (response_id == Gtk.ResponseType.REJECT)
+                    quit ();
                 dialog.destroy ();
             });
 


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