[gnome-robots] Got rid of warnings.
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-robots] Got rid of warnings.
- Date: Sun, 14 Feb 2016 03:31:42 +0000 (UTC)
commit aee2b1a0326f11bf61e3685a77357081d19a65a0
Author: Nikhar Agrawal <nikharagrawal2006 gmail com>
Date: Mon Aug 18 03:04:11 2014 +0530
Got rid of warnings.
src/game.c | 6 ++++--
src/gnome-robots.c | 32 +++++++++++++++++---------------
src/gnome-robots.h | 1 +
3 files changed, 22 insertions(+), 17 deletions(-)
---
diff --git a/src/game.c b/src/game.c
index 75f046a..b935a0e 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;
+GamesScoresCategory* current_cat;
/**********************************************************************/
/* Function Definitions */
@@ -232,7 +232,9 @@ log_score (gint sc)
if (sc != 0) {
// games_scores_set_category (highscores, sbuf);
- current_cat = games_scores_category_new (sbuf, name_from_key (sbuf));
+ const gchar* key = sbuf;
+ const gchar* name = category_name_from_key (key);
+ current_cat = games_scores_category_new (key, name);
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 f8de478..e15c304 100644
--- a/src/gnome-robots.c
+++ b/src/gnome-robots.c
@@ -172,6 +172,19 @@ update_game_status (gint score, gint current_level, gint safes)
g_free (button_text);
}
+const gchar
+*category_name_from_key (const gchar* key)
+{
+ int i;
+ for (i = 0; i < no_categories; i++)
+ {
+ if (g_strcmp0 (scorecats[i].key, key) == 0)
+ return scorecats[i].name;
+ }
+ /*Return key as is if match not found*/
+ return NULL;
+}
+
static void
preferences_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data)
{
@@ -316,21 +329,10 @@ shutdown (GtkApplication *app, gpointer user_data)
g_settings_set_boolean (settings, "window-is-maximized", window_is_maximized);
}
-gchar* name_from_key (gchar* key)
-{
- int i;
- for (i = 0; i < no_categories; i++)
- {
- if (g_strcmp0 (scorecats[i].key, key) == 0)
- return scorecats[i].name;
- }
- /*Return key as is if match not found*/
- return NULL;
-}
-
-GamesScoresCategory *create_category_from_key (GamesScoresContext *context, const char *key, gpointer
user_data)
+static GamesScoresCategory
+*create_category_from_key (GamesScoresContext *context, const char *key, gpointer user_data)
{
- gchar *name = name_from_key (key);
+ const gchar *name = category_name_from_key (key);
if (name == NULL)
return NULL;
return games_scores_category_new (key, name);
@@ -426,7 +428,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:"),
- window,
+ GTK_WINDOW (window),
GAMES_SCORES_STYLE_PLAIN_DESCENDING);
g_signal_connect (highscores, "request-category", G_CALLBACK (create_category_from_key), NULL);
gtk_widget_show_all (window);
diff --git a/src/gnome-robots.h b/src/gnome-robots.h
index 3dfaf0c..1f637c6 100644
--- a/src/gnome-robots.h
+++ b/src/gnome-robots.h
@@ -20,6 +20,7 @@ extern GSettings *settings;
void set_move_action_sensitivity (gboolean state);
void update_game_status (gint score, gint level, gint safe_teleports);
void quit_game (void);
+gchar* category_name_from_key (const gchar*);
/**********************************************************************/
#endif /* GNOBOTS_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]