[gnome-robots/wip/libgames-support: 12/22] GamesScoresCategory class now. Made changes accordingly.



commit accc407ee9efe3165e3a72750dea70351c88b662
Author: Nikhar Agrawal <nikharagrawal2006 gmail com>
Date:   Sat Aug 16 21:59:48 2014 +0530

    GamesScoresCategory class now. Made changes accordingly.

 src/game.c         |    7 +++----
 src/gnome-robots.c |   25 ++-----------------------
 2 files changed, 5 insertions(+), 27 deletions(-)
---
diff --git a/src/game.c b/src/game.c
index d1b2439..6e9b742 100644
--- a/src/game.c
+++ b/src/game.c
@@ -92,7 +92,7 @@ static gboolean random_teleport (void);
 static gboolean safe_teleport (void);
 /**********************************************************************/
 
-struct _GamesScoresCategory current_cat;
+struct GamesScoresCategory* current_cat;
 
 /**********************************************************************/
 /* Function Definitions                                               */
@@ -232,9 +232,8 @@ log_score (gint sc)
 
   if (sc != 0) {
   //  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);
+    current_cat = games_scores_category_new (sbuf, 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 f6e0938..32f3cf2 100644
--- a/src/gnome-robots.c
+++ b/src/gnome-robots.c
@@ -55,7 +55,6 @@ static gboolean window_is_maximized = FALSE;
 GtkWidget *game_area = NULL;
 GamesScoresContext *highscores;
 GSettings *settings;
-GamesScoresCategory cat = {"",""};
 /**********************************************************************/
 
 /**********************************************************************/
@@ -92,24 +91,6 @@ static const GActionEntry win_entries[] = {
   { "wait", wait_cb, NULL, NULL, NULL },
 };
 
-static const GamesScoresCategory scorecats[] = {
-  {"classic_robots", N_("Classic robots")},
-  {"classic_robots-safe", N_("Classic robots with safe moves")},
-  {"classic_robots-super-safe", N_("Classic robots with super-safe moves")},
-  {"nightmare", N_("Nightmare")},
-  {"nightmare-safe", N_("Nightmare with safe moves")},
-  {"nightmare-super-safe", N_("Nightmare with super-safe moves")},
-  {"robots2", N_("Robots2")},
-  {"robots2-safe", N_("Robots2 with safe moves")},
-  {"robots2-super-safe", N_("Robots2 with super-safe moves")},
-  {"robots2_easy", N_("Robots2 easy")},
-  {"robots2_easy-safe", N_("Robots2 easy with safe moves")},
-  {"robots2_easy-super-safe", N_("Robots2 easy with super-safe moves")},
-  {"robots_with_safe_teleport", N_("Robots with safe teleport")},
-  {"robots_with_safe_teleport-safe", N_("Robots with safe teleport with safe moves")},
-  {"robots_with_safe_teleport-super-safe", N_("Robots with safe teleport with super-safe moves")}
-};
-
 static gint safe_teleports = 0;
 static GtkWidget *safe_teleports_label;
 static GtkWidget *headerbar;
@@ -308,9 +289,7 @@ shutdown (GtkApplication *app, gpointer user_data)
 
 GamesScoresCategory *create_category_from_key (GamesScoresContext *context, const char *key, gpointer 
user_data)
 {
-  cat.key = key;
-  cat.name = "whoa";
-  return &cat;
+       return games_scores_category_new (key, key);
 }
 
 static void
@@ -400,7 +379,7 @@ activate (GtkApplication *app, gpointer user_data)
 
   highscores = games_scores_context_new ("gnome-robots",
                                          /* Label on the scores dialog, next to map type dropdown */
-                                         _("Game Type"),
+                                         _("Game Type :"),
                                          window,
                                          GAMES_SCORES_STYLE_PLAIN_DESCENDING);
   g_signal_connect (highscores, "request-category", G_CALLBACK (create_category_from_key), NULL);


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