seed r539 - trunk/examples/lightsoff



Author: hortont
Date: Tue Dec 23 06:56:58 2008
New Revision: 539
URL: http://svn.gnome.org/viewvc/seed?rev=539&view=rev

Log:
Catch LO GConf exceptions.


Modified:
   trunk/examples/lightsoff/arrow.js
   trunk/examples/lightsoff/board.js
   trunk/examples/lightsoff/main.js
   trunk/examples/lightsoff/score.js

Modified: trunk/examples/lightsoff/arrow.js
==============================================================================
--- trunk/examples/lightsoff/arrow.js	(original)
+++ trunk/examples/lightsoff/arrow.js	Tue Dec 23 06:56:58 2008
@@ -11,7 +11,15 @@
 	
 	score.set_value(score.value + direction);
 	swap_animation(direction);
-	gconf_client.set_int("/apps/lightsoff/score", score.value);
+
+	try
+	{
+		gconf_client.set_int("/apps/lightsoff/score", score.value);
+	}
+	catch(e)
+	{
+		Seed.print("Couldn't save score to GConf.");
+	}
 	
 	return true;
 }

Modified: trunk/examples/lightsoff/board.js
==============================================================================
--- trunk/examples/lightsoff/board.js	(original)
+++ trunk/examples/lightsoff/board.js	Tue Dec 23 06:56:58 2008
@@ -100,7 +100,16 @@
 	if(light.get_parent().cleared() && !in_setup)
 	{
 		score.set_value(score.value+1);
-		gconf_client.set_int("/apps/lightsoff/score", score.value);
+
+		try
+		{
+			gconf_client.set_int("/apps/lightsoff/score", score.value);
+		}
+		catch(e)
+		{
+			Seed.print("Couldn't save score to GConf.");
+		}
+
 		win_animation();
 	}
 }

Modified: trunk/examples/lightsoff/main.js
==============================================================================
--- trunk/examples/lightsoff/main.js	(original)
+++ trunk/examples/lightsoff/main.js	Tue Dec 23 06:56:58 2008
@@ -24,6 +24,17 @@
 Seed.include("arrow.js");
 
 var gconf_client = GConf.Client.get_default();
+var initial_score = 1;
+
+try
+{
+	initial_score = gconf_client.get_int("/apps/lightsoff/score")
+}
+catch(e)
+{
+	initial_score = 1;
+	Seed.print("Couldn't load score from GConf.");
+}
 
 var black = Clutter.Color._new();
 Clutter.color_parse("Black", black);

Modified: trunk/examples/lightsoff/score.js
==============================================================================
--- trunk/examples/lightsoff/score.js	(original)
+++ trunk/examples/lightsoff/score.js	Tue Dec 23 06:56:58 2008
@@ -72,7 +72,7 @@
 		this.bkg_top.set_position(1, 1);
 		this.add_actor(this.bkg_top);
 
-		this.set_value(gconf_client.get_int("/apps/lightsoff/score"));
+		this.set_value(initial_score);
 		
 		if(this.value == 0)
 			this.set_value(1);



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