[gnome-nibbles] Fixed sensitivity of menu items
- From: Bryan Quigley <bryanquigs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-nibbles] Fixed sensitivity of menu items
- Date: Sun, 2 Feb 2014 05:08:10 +0000 (UTC)
commit 260dd25dfcac0b84e36b574abf3bb2879fe0cfbc
Author: Bryan Quigley <bryanquigs src gnome org>
Date: Sun Feb 2 00:07:49 2014 -0500
Fixed sensitivity of menu items
src/main.c | 21 +++++++++++++++++----
src/main.h | 1 -
2 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/src/main.c b/src/main.c
index 99d6b3b..dbc7f7e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -96,7 +96,10 @@ static gboolean new_game_2_cb (GtkWidget * widget, gpointer data);
static gint add_bonus_cb (gpointer data);
-static GtkAction *preferences_action;
+static GSimpleAction *new_game_action;
+static GSimpleAction *end_game_action;
+static GSimpleAction *pause_action;
+static GSimpleAction *preferences_action;
gint
game_running (void)
@@ -260,6 +263,7 @@ static GActionEntry app_entries[] = {
static gboolean
key_press_cb (ClutterActor *actor, ClutterEvent *event, gpointer data)
{
+
if (!(event->type == CLUTTER_KEY_PRESS))
return FALSE;
@@ -335,7 +339,10 @@ gboolean
new_game (void)
{
int i;
- //TODO Needs to sensitivity for game being active here
+ g_simple_action_set_enabled (new_game_action, FALSE);
+ g_simple_action_set_enabled (end_game_action, TRUE);
+ g_simple_action_set_enabled (pause_action, TRUE);
+ g_simple_action_set_enabled (preferences_action, FALSE);
if (game_running ()) {
main_id = 0;
@@ -407,7 +414,10 @@ end_game (void)
animate_end_game ();
- //TODO Needs to set sensitivity for game not being played here.
+ g_simple_action_set_enabled (new_game_action, TRUE);
+ g_simple_action_set_enabled (end_game_action, FALSE);
+ g_simple_action_set_enabled (pause_action, FALSE);
+ g_simple_action_set_enabled (preferences_action, TRUE);
is_paused = FALSE;
}
@@ -644,7 +654,10 @@ activate (GtkApplication* app,
gtk_application_set_app_menu (GTK_APPLICATION (app), G_MENU_MODEL (gtk_builder_get_object (builder,
"app-menu")));
-
+ new_game_action = G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (app) , "newgame"));
+ end_game_action = G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (app) , "endgame"));
+ pause_action = G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (app) , "pause"));
+ preferences_action = G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (app) , "preferences"));
clutter_widget = gtk_clutter_embed_new ();
stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter_widget));
diff --git a/src/main.h b/src/main.h
index 011e067..5fc0cf5 100644
--- a/src/main.h
+++ b/src/main.h
@@ -32,7 +32,6 @@ int num_players;
int seat;
int seats[NUMWORMS];
char names[NUMWORMS][17];
-extern GtkAction *pause_action;
gboolean game_running (void);
void end_game (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]