[gnome-games/gsoc-seed-games] [lightsoff] Check if loaded theme exists; if not, set to default



commit 5d5072f7d01e418a5c0bb23f6e4a77c895e24722
Author: Tim Horton <hortont svn gnome org>
Date:   Mon Jun 29 00:21:07 2009 -0400

    [lightsoff] Check if loaded theme exists; if not, set to default

 lightsoff/Settings.js |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/lightsoff/Settings.js b/lightsoff/Settings.js
index 7ffc9dc..defb7db 100644
--- a/lightsoff/Settings.js
+++ b/lightsoff/Settings.js
@@ -8,6 +8,7 @@ GConf.init(Seed.argv);
 
 // Defaults
 var theme, score;
+var default_theme = "Tango";
 
 // Map theme names to themes
 var themes = {};
@@ -19,11 +20,14 @@ try
 	gconf_client = GConf.Client.get_default();
 	score = gconf_client.get_int("/apps/lightsoff/score");
 	theme = themes[gconf_client.get_string("/apps/lightsoff/theme")];
+	
+	if(theme == null)
+		theme = themes[default_theme];
 }
 catch(e)
 {
 	print("Couldn't load settings from GConf.");
-	theme = themes["Tango"];
+	theme = themes[default_theme];
 	score = 1;
 }
 



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