[gnome-games] [same-gnome-clutter] Finish display of high scores.



commit acc6f0f4b462b5a7e05d12cf82276c3a89b5254d
Author: Tim Horton <hortont424 gmail com>
Date:   Wed Jul 29 18:12:46 2009 -0400

    [same-gnome-clutter] Finish display of high scores.
    
    Apparently you have to call setgid_io_init manually if you need that
    functionality (which the scores code uses internally). I didn't realize
    this, so I've been running around trying to determine why l-g-s locked up
    in a bizarre place (read() or some such). This took an inordinate amount of
    time to figure out. Sorry! Now, to *save* scores...

 same-gnome-clutter/src/Score.js |   38 ++++++++++++++++++--------------------
 same-gnome-clutter/src/main.js  |    5 +++++
 2 files changed, 23 insertions(+), 20 deletions(-)
---
diff --git a/same-gnome-clutter/src/Score.js b/same-gnome-clutter/src/Score.js
index 60e6377..83aa8f8 100644
--- a/same-gnome-clutter/src/Score.js
+++ b/same-gnome-clutter/src/Score.js
@@ -50,21 +50,20 @@ function game_completed(won)
 
 function show_scores_dialog()
 {
-	var highscores_dialog = new GnomeGamesSupport.ScoresDialog();
-	highscores_dialog.parent_window = main.window;
-	highscores_dialog.scores = highscores;
-	highscores_dialog.title = _("Same GNOME Scores");
-	//highscores_dialog.add_category("
-	
-	// TODO: set up high scores categories (for different board sizes)
-	
-	highscores_dialog.set_buttons(GnomeGamesSupport.ScoresButtons.QUIT_BUTTON);
-	
+	var highscores_dialog = new GnomeGamesSupport.ScoresDialog.c_new(
+		main.window, highscores, _("Same GNOME Scores"));
+
+	highscores_dialog.set_category_description(_("Size:"));
+		
 	highscores_dialog.run();
-	
 	highscores_dialog.hide();
 }
 
+function update_score_category()
+{
+	highscores.set_category(Settings.sizes[Settings.size].name);
+}
+
 ScoreView = new GType({
 	parent: Clutter.Group.type,
 	name: "Score",
@@ -138,15 +137,14 @@ ScoreView = new GType({
 
 // Initialize high scores with libgames-support
 
-/*highscores = new GnomeGamesSupport.Scores({app_name: "same-gnome-clutter"});
+highscores = new GnomeGamesSupport.Scores.c_new("same-gnome", null,
+                                                null, "board size", null, 0,
+                                GnomeGamesSupport.ScoreStyle.PLAIN_DESCENDING);
 
-highscores.add_category("Small", _("Small"));*/
+highscores.add_category("Small", _("Small"));
+highscores.add_category("Normal", _("Normal"));
+highscores.add_category("Large", _("Large"));
 
-/*cat = new GnomeGamesSupport.ScoresCategory();
-cat.key = "Small";
-cat.name = "Small";
+update_score_category();
 
-highscores = new GnomeGamesSupport.Scores.c_new("same-gnome", [cat],
-                                                1, "board size", null, 0, 0);
-*/
-//highscores.add_category("Small", _("Small"));
+Settings.Watcher.signal.size_changed.connect(update_score_category);
diff --git a/same-gnome-clutter/src/main.js b/same-gnome-clutter/src/main.js
index 58c2c31..f6a360a 100755
--- a/same-gnome-clutter/src/main.js
+++ b/same-gnome-clutter/src/main.js
@@ -14,7 +14,12 @@ GnomeGamesSupport = imports.gi.GnomeGamesSupport;
 _ = imports.gettext.gettext;
 
 GtkClutter.init(Seed.argv);
+
+if(GnomeGamesSupport.setgid_io_init)
+	GnomeGamesSupport.setgid_io_init();
+
 GnomeGamesSupport.runtime_init("same-gnome");
+GnomeGamesSupport.Conf.initialise("same-gnome");
 GnomeGamesSupport.stock_init();
 
 GConf.init(Seed.argv);



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