[gnome-robots/libgames-scores: 2/14] Modified game to use new libgames-scores written in Vala.



commit 2bde6cac001afd5f732ffd315533f808b886fc5a
Author: Nikhar Agrawal <nikharagrawal2006 gmail com>
Date:   Thu Jul 17 23:29:30 2014 +0530

    Modified game to use new libgames-scores written in Vala.

 src/game.c         |   17 ++++++++++-------
 src/gnome-robots.c |    9 +++------
 src/gnome-robots.h |    2 +-
 src/graphics.c     |    1 -
 src/properties.c   |    1 -
 5 files changed, 14 insertions(+), 16 deletions(-)
---
diff --git a/src/game.c b/src/game.c
index 49f3770..9ce351b 100644
--- a/src/game.c
+++ b/src/game.c
@@ -38,7 +38,6 @@
 #include "graphics.h"
 #include "cursors.h"
 #include "games-scores.h"
-#include "games-scores-dialog.h"
 
 /**********************************************************************/
 /* Exported Variables                                                 */
@@ -94,6 +93,7 @@ static gboolean random_teleport (void);
 static gboolean safe_teleport (void);
 /**********************************************************************/
 
+struct _GamesScoresCategory current_cat;
 
 /**********************************************************************/
 /* Function Definitions                                               */
@@ -129,7 +129,8 @@ message_box (gchar * msg)
 gint
 show_scores (gint pos, gboolean endofgame)
 {
-  gchar *message;
+  games_scores_context_print_scores (highscores);
+/*  gchar *message;
   static GtkWidget *scoresdialog = NULL;
   static GtkWidget *sorrydialog = NULL;
   GtkWidget *dialog;
@@ -196,9 +197,9 @@ show_scores (gint pos, gboolean endofgame)
   }
 
   result = gtk_dialog_run (GTK_DIALOG (dialog));
-  gtk_widget_hide (dialog);
-
-  return result;
+  gtk_widget_hide (dialog);*/
+  
+  return 0;
 }
 
 /**
@@ -231,8 +232,10 @@ log_score (gint sc)
   }
 
   if (sc != 0) {
-    games_scores_set_category (highscores, sbuf);
-    pos = games_scores_add_plain_score (highscores, (guint32) sc);
+  //  games_scores_set_category (highscores, sbuf);
+    current_cat.key = sbuf;
+    current_cat.name = sbuf;
+    pos = games_scores_context_add_score (highscores, (guint32) sc, &current_cat);
   }
   g_free (sbuf);
 
diff --git a/src/gnome-robots.c b/src/gnome-robots.c
index 2382872..7eac1e2 100644
--- a/src/gnome-robots.c
+++ b/src/gnome-robots.c
@@ -1,3 +1,4 @@
+
 /*
  * Gnome Robots II
  * written by Mark Rae <m rae inpharmatica co uk>
@@ -38,7 +39,6 @@
 #include "cursors.h"
 #include "games-gridframe.h"
 #include "games-scores.h"
-#include "games-scores-dialog.h"
 
 /* Minimum sizes. */
 #define MINIMUM_TILE_WIDTH   8
@@ -53,7 +53,7 @@ GtkWidget *window = NULL;
 static gint window_width = 0, window_height = 0;
 static gboolean window_is_maximized = FALSE;
 GtkWidget *game_area = NULL;
-GamesScores *highscores;
+GamesScoresContext *highscores;
 GSettings *settings;
 /**********************************************************************/
 
@@ -297,10 +297,7 @@ startup (GtkApplication *app, gpointer user_data)
 
   g_set_application_name (_("Robots"));
 
-  highscores = games_scores_new ("gnome-robots",
-                                 scorecats, G_N_ELEMENTS (scorecats),
-                                 NULL, NULL,
-                                 0 /* default category */,
+  highscores = games_scores_context_new ("gnome-robots",
                                  GAMES_SCORES_STYLE_PLAIN_DESCENDING);
 
   settings = g_settings_new ("org.gnome.robots");
diff --git a/src/gnome-robots.h b/src/gnome-robots.h
index 98cfa91..3dfaf0c 100644
--- a/src/gnome-robots.h
+++ b/src/gnome-robots.h
@@ -10,7 +10,7 @@
 /**********************************************************************/
 extern GtkWidget *window;
 extern GtkWidget *game_area;
-extern GamesScores *highscores;
+extern GamesScoresContext *highscores;
 extern GSettings *settings;
 /**********************************************************************/
 
diff --git a/src/graphics.c b/src/graphics.c
index abb3997..53d508b 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -39,7 +39,6 @@
 #include "properties.h"
 #include "games-preimage.h"
 #include "games-scores.h"
-#include "games-scores-dialog.h"
 
 /**********************************************************************/
 
diff --git a/src/properties.c b/src/properties.c
index 1b8e473..61f336a 100644
--- a/src/properties.c
+++ b/src/properties.c
@@ -38,7 +38,6 @@
 #include "games-file-list.h"
 #include "games-controls.h"
 #include "games-scores.h"
-#include "games-scores-dialog.h"
 
 
 /**********************************************************************/


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