[gnome-sudoku] Rework the well done dialog
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sudoku] Rework the well done dialog
- Date: Mon, 15 Sep 2014 21:40:02 +0000 (UTC)
commit 29ce0f5ce687e61f14b88cf24e63dd4bec5b576e
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 c1c674b..7567a3d 100644
--- a/src/gnome-sudoku.vala
+++ b/src/gnome-sudoku.vala
@@ -247,24 +247,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]