[gnome-sudoku] Revert to old names for difficulty levels
- From: Parin Porecha <parinporecha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sudoku] Revert to old names for difficulty levels
- Date: Mon, 18 Aug 2014 21:20:51 +0000 (UTC)
commit a88522a32a625b900d7f27001a9e366483e5e8c3
Author: Parin Porecha <parinporecha gmail com>
Date: Mon Aug 18 23:17:32 2014 +0200
Revert to old names for difficulty levels
Also show a warning and fallback to Easy difficulty
whenever a difficulty string cannot be parsed
https://bugzilla.gnome.org/show_bug.cgi?id=734892
data/gnome-sudoku.ui | 16 ++++++------
data/org.gnome.sudoku.gschema.xml | 10 +++---
data/print-games.ui | 16 ++++++------
lib/sudoku-board.vala | 35 ++++++++++---------------
src/sudoku-printer.vala | 50 ++++++++++++++++++------------------
5 files changed, 60 insertions(+), 67 deletions(-)
---
diff --git a/data/gnome-sudoku.ui b/data/gnome-sudoku.ui
index d85f406..209a6ea 100644
--- a/data/gnome-sudoku.ui
+++ b/data/gnome-sudoku.ui
@@ -102,9 +102,9 @@
<object class="GtkButton" id="easy_button">
<property name="visible">True</property>
<property name="use_underline">True</property>
- <property name="label" translatable="yes">_Simple</property>
+ <property name="label" translatable="yes">_Easy</property>
<property name="action-name">app.start-game</property>
- <property name="action-target">1</property> <!-- 1 corresponds to enum
DifficultyCategory.SIMPLE -->
+ <property name="action-target">1</property> <!-- 1 corresponds to enum
DifficultyCategory.EASY -->
</object>
<packing>
<property name="expand">True</property>
@@ -116,9 +116,9 @@
<object class="GtkButton" id="medium_button">
<property name="visible">True</property>
<property name="use_underline">True</property>
- <property name="label" translatable="yes">_Easy</property>
+ <property name="label" translatable="yes">_Medium</property>
<property name="action-name">app.start-game</property>
- <property name="action-target">2</property> <!-- 2 corresponds to enum
DifficultyCategory.EASY -->
+ <property name="action-target">2</property> <!-- 2 corresponds to enum
DifficultyCategory.MEDIUM -->
</object>
<packing>
<property name="expand">True</property>
@@ -130,9 +130,9 @@
<object class="GtkButton" id="hard_button">
<property name="visible">True</property>
<property name="use_underline">True</property>
- <property name="label" translatable="yes">_Intermediate</property>
+ <property name="label" translatable="yes">_Hard</property>
<property name="action-name">app.start-game</property>
- <property name="action-target">3</property> <!-- 3 corresponds to enum
DifficultyCategory.INTERMEDIATE -->
+ <property name="action-target">3</property> <!-- 3 corresponds to enum
DifficultyCategory.HARD -->
</object>
<packing>
<property name="expand">True</property>
@@ -144,9 +144,9 @@
<object class="GtkButton" id="very_hard_button">
<property name="visible">True</property>
<property name="use_underline">True</property>
- <property name="label" translatable="yes">_Expert</property>
+ <property name="label" translatable="yes">_Very Hard</property>
<property name="action-name">app.start-game</property>
- <property name="action-target">4</property> <!-- 4 corresponds to enum
DifficultyCategory.EXPERT -->
+ <property name="action-target">4</property> <!-- 4 corresponds to enum
DifficultyCategory.VERY_HARD -->
</object>
<packing>
<property name="expand">True</property>
diff --git a/data/org.gnome.sudoku.gschema.xml b/data/org.gnome.sudoku.gschema.xml
index 818ad8f..8b5aa05 100644
--- a/data/org.gnome.sudoku.gschema.xml
+++ b/data/org.gnome.sudoku.gschema.xml
@@ -1,15 +1,15 @@
<schemalist>
<enum id="org.gnome.sudoku.print-multiple-sudoku-difficulty">
- <value nick="simple" value="1" />
- <value nick="easy" value="2" />
- <value nick="intermediate" value="3" />
- <value nick="expert" value="4" />
+ <value nick="easy" value="1" />
+ <value nick="medium" value="2" />
+ <value nick="hard" value="3" />
+ <value nick="very_hard" value="4" />
</enum>
<schema id="org.gnome.sudoku" path="/org/gnome/sudoku/" gettext-domain="gnome-sudoku">
<key name="print-multiple-sudoku-difficulty" enum="org.gnome.sudoku.print-multiple-sudoku-difficulty">
<default>"easy"</default>
<summary>Difficulty level of sudokus to be printed</summary>
- <description>Set the difficulty level of the sudokus you want to print. Possible values are -
"simple", "easy", "intermediate", "expert"</description>
+ <description>Set the difficulty level of the sudokus you want to print. Possible values are - "easy",
"medium", "hard", "very_hard"</description>
</key>
<key name="print-multiple-sudokus-to-print" type="i">
<default>4</default>
diff --git a/data/print-games.ui b/data/print-games.ui
index d204313..6c4a741 100644
--- a/data/print-games.ui
+++ b/data/print-games.ui
@@ -150,8 +150,8 @@
<property name="valign">start</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
- <object class="GtkRadioButton" id="simpleRadioButton">
- <property name="label" translatable="yes">_Simple</property>
+ <object class="GtkRadioButton" id="easyRadioButton">
+ <property name="label" translatable="yes">_Easy</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -166,8 +166,8 @@
</packing>
</child>
<child>
- <object class="GtkRadioButton" id="easyRadioButton">
- <property name="label" translatable="yes">_Easy</property>
+ <object class="GtkRadioButton" id="mediumRadioButton">
+ <property name="label" translatable="yes">_Medium</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -182,8 +182,8 @@
</packing>
</child>
<child>
- <object class="GtkRadioButton" id="intermediateRadioButton">
- <property name="label" translatable="yes">_Intermediate</property>
+ <object class="GtkRadioButton" id="hardRadioButton">
+ <property name="label" translatable="yes">_Hard</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -198,8 +198,8 @@
</packing>
</child>
<child>
- <object class="GtkRadioButton" id="expertRadioButton">
- <property name="label" translatable="yes">_Expert</property>
+ <object class="GtkRadioButton" id="very_hardRadioButton">
+ <property name="label" translatable="yes">_Very Hard</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
diff --git a/lib/sudoku-board.vala b/lib/sudoku-board.vala
index db82bb5..75fd08f 100644
--- a/lib/sudoku-board.vala
+++ b/lib/sudoku-board.vala
@@ -530,10 +530,10 @@ public struct Cell
public enum DifficultyCategory {
UNKNOWN,
- SIMPLE,
EASY,
- INTERMEDIATE,
- EXPERT;
+ MEDIUM,
+ HARD,
+ VERY_HARD;
public string to_string ()
{
@@ -541,14 +541,14 @@ public enum DifficultyCategory {
{
case UNKNOWN:
return _("Unknown Difficulty");
- case SIMPLE:
- return _("Simple Difficulty");
case EASY:
return _("Easy Difficulty");
- case INTERMEDIATE:
- return _("Intermediate Difficulty");
- case EXPERT:
- return _("Expert Difficulty");
+ case MEDIUM:
+ return _("Medium Difficulty");
+ case HARD:
+ return _("Hard Difficulty");
+ case VERY_HARD:
+ return _("Very Hard Difficulty");
default:
assert_not_reached ();
}
@@ -560,24 +560,17 @@ public enum DifficultyCategory {
{
case "Unknown Difficulty":
return UNKNOWN;
- case "Simple Difficulty":
- return SIMPLE;
case "Easy Difficulty":
return EASY;
- case "Intermediate Difficulty":
- return INTERMEDIATE;
- case "Expert Difficulty":
- return EXPERT;
-
- // Backward compatibility
case "Medium Difficulty":
- return EASY;
+ return MEDIUM;
case "Hard Difficulty":
- return INTERMEDIATE;
+ return HARD;
case "Very Hard Difficulty":
- return EXPERT;
+ return VERY_HARD;
default:
- assert_not_reached ();
+ warning ("Could not parse difficulty level. Falling back to Easy difficulty");
+ return EASY;
}
}
}
diff --git a/src/sudoku-printer.vala b/src/sudoku-printer.vala
index 1abbe98..9f80280 100644
--- a/src/sudoku-printer.vala
+++ b/src/sudoku-printer.vala
@@ -224,10 +224,10 @@ public class GamePrinter: GLib.Object
private Gtk.Dialog dialog;
private SpinButton nsudokus_button;
- private RadioButton simple_button;
private RadioButton easy_button;
- private RadioButton intermediate_button;
- private RadioButton expert_button;
+ private RadioButton medium_button;
+ private RadioButton hard_button;
+ private RadioButton very_hard_button;
private Spinner spinner;
@@ -256,28 +256,28 @@ public class GamePrinter: GLib.Object
SList<RadioButton> radio_group = new SList<RadioButton> ();
- simple_button = builder.get_object ("simpleRadioButton") as RadioButton;
- simple_button.set_group (radio_group);
-
easy_button = builder.get_object ("easyRadioButton") as RadioButton;
- easy_button.join_group (simple_button);
+ easy_button.set_group (radio_group);
+
+ medium_button = builder.get_object ("mediumRadioButton") as RadioButton;
+ medium_button.join_group (easy_button);
- intermediate_button = builder.get_object ("intermediateRadioButton") as RadioButton;
- intermediate_button.join_group (simple_button);
+ hard_button = builder.get_object ("hardRadioButton") as RadioButton;
+ hard_button.join_group (easy_button);
- expert_button = builder.get_object ("expertRadioButton") as RadioButton;
- expert_button.join_group (simple_button);
+ very_hard_button = builder.get_object ("very_hardRadioButton") as RadioButton;
+ very_hard_button.join_group (easy_button);
var saved_difficulty = (DifficultyCategory) settings.get_enum (DIFFICULTY_KEY_NAME);
- if (saved_difficulty == DifficultyCategory.SIMPLE)
- simple_button.set_active (true);
- else if (saved_difficulty == DifficultyCategory.EASY)
+ if (saved_difficulty == DifficultyCategory.EASY)
easy_button.set_active (true);
- else if (saved_difficulty == DifficultyCategory.INTERMEDIATE)
- intermediate_button.set_active (true);
- else if (saved_difficulty == DifficultyCategory.EXPERT)
- expert_button.set_active (true);
+ else if (saved_difficulty == DifficultyCategory.MEDIUM)
+ medium_button.set_active (true);
+ else if (saved_difficulty == DifficultyCategory.HARD)
+ hard_button.set_active (true);
+ else if (saved_difficulty == DifficultyCategory.VERY_HARD)
+ very_hard_button.set_active (true);
nsudokus_button = builder.get_object ("sudokusToPrintSpinButton") as SpinButton;
wrap_adjustment ("print-multiple-sudokus-to-print", nsudokus_button.get_adjustment ());
@@ -302,14 +302,14 @@ public class GamePrinter: GLib.Object
var nsudokus = (int) nsudokus_button.get_adjustment ().get_value ();
DifficultyCategory level;
- if (simple_button.get_active ())
- level = DifficultyCategory.SIMPLE;
- else if (easy_button.get_active ())
+ if (easy_button.get_active ())
level = DifficultyCategory.EASY;
- else if (intermediate_button.get_active ())
- level = DifficultyCategory.INTERMEDIATE;
- else if (expert_button.get_active ())
- level = DifficultyCategory.EXPERT;
+ else if (medium_button.get_active ())
+ level = DifficultyCategory.MEDIUM;
+ else if (hard_button.get_active ())
+ level = DifficultyCategory.HARD;
+ else if (very_hard_button.get_active ())
+ level = DifficultyCategory.VERY_HARD;
else
assert_not_reached ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]