[gbrainy] Apply color blind setting within the same session if changed in the preferences
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gbrainy] Apply color blind setting within the same session if changed in the preferences
- Date: Sun, 19 Jun 2011 21:04:52 +0000 (UTC)
commit 0fa426596efd3c923a153da4c3b73ff9c2eeef36
Author: Jordi Mas <jmas softcatala org>
Date: Sun Jun 19 23:04:04 2011 +0200
Apply color blind setting within the same session if changed in the preferences
src/Clients/Classical/gbrainy.cs | 1 +
src/Core/Main/GameManager.cs | 16 ++++++++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/Clients/Classical/gbrainy.cs b/src/Clients/Classical/gbrainy.cs
index 3595d11..a99dba2 100644
--- a/src/Clients/Classical/gbrainy.cs
+++ b/src/Clients/Classical/gbrainy.cs
@@ -563,6 +563,7 @@ namespace gbrainy.Clients.Classical
dialog = new PreferencesDialog (session.PlayerHistory);
if ((Gtk.ResponseType) dialog.Run () == ResponseType.Ok) {
session.Difficulty = (GameDifficulty) Preferences.Get <int> (Preferences.DifficultyKey);
+ session.GameManager.ColorBlind = Preferences.Get <bool> (Preferences.ColorBlindKey);
if (dialog.NewThemeSet == true)
drawing_area.ReloadBackground ();
diff --git a/src/Core/Main/GameManager.cs b/src/Core/Main/GameManager.cs
index be9b760..93f2cbf 100644
--- a/src/Core/Main/GameManager.cs
+++ b/src/Core/Main/GameManager.cs
@@ -61,7 +61,8 @@ namespace gbrainy.Core.Main
GameSession.Types game_type;
IEnumerator <int> enumerator;
- GameDifficulty difficulty;
+ GameDifficulty difficulty;
+ bool color_blind;
List <GameLocator> available_games; // List of all available games in the system
List <int> play_list; // Play list for the Selected difficulty, game types
@@ -143,7 +144,18 @@ namespace gbrainy.Core.Main
// Indicates if the PlayList for CustomGames is delivered in RandomOrder
public bool RandomOrder { get; set; }
- public bool ColorBlind { get; set; }
+ public bool ColorBlind {
+ get { return color_blind;}
+ set {
+ if (color_blind == value)
+ return;
+
+ color_blind = value;
+
+ if ((game_type & GameSession.Types.Custom) != GameSession.Types.Custom)
+ BuildPlayList (available_games);
+ }
+ }
// Returns all the games available for playing
public GameLocator [] AvailableGames {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]