[four-in-a-row] Disallow multiple windows (nonsense gameplay)
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [four-in-a-row] Disallow multiple windows (nonsense gameplay)
- Date: Thu, 25 Sep 2014 22:52:53 +0000 (UTC)
commit 86dd19192d576416a437dfcbe15cf7fd0c525d02
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Thu Sep 25 17:52:24 2014 -0500
Disallow multiple windows (nonsense gameplay)
src/main.c | 31 ++++++++++++++++---------------
1 files changed, 16 insertions(+), 15 deletions(-)
---
diff --git a/src/main.c b/src/main.c
index 700830f..495f092 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1088,8 +1088,8 @@ static const GActionEntry app_entries[] = {
{"about", on_help_about, NULL, NULL, NULL}
};
-static gboolean
-create_app (void)
+static void
+create_app (GApplication *app, gpointer user_data)
{
GtkWidget *frame;
GMenu *app_menu, *section;
@@ -1166,20 +1166,20 @@ create_app (void)
g_simple_action_set_enabled (G_SIMPLE_ACTION (hint_action), FALSE);
g_simple_action_set_enabled (G_SIMPLE_ACTION (undo_action), FALSE);
-
- gtk_widget_show_all (window);
-
- gfx_refresh_pixmaps ();
- gfx_draw_all ();
-
- scorebox_update (); /* update visible player descriptions */
- prompt_player ();
-
- game_reset ();
- return TRUE;
}
-
+static void
+activate (GApplication *app, gpointer user_data)
+{
+ if (!gtk_widget_is_visible (window)) {
+ gtk_widget_show_all (window);
+ gfx_refresh_pixmaps ();
+ gfx_draw_all ();
+ scorebox_update (); /* update visible player descriptions */
+ prompt_player ();
+ game_reset ();
+ }
+}
int
main (int argc, char *argv[])
@@ -1195,7 +1195,8 @@ main (int argc, char *argv[])
textdomain (GETTEXT_PACKAGE);
application = gtk_application_new ("org.gnome.four-in-a-row", 0);
- g_signal_connect (application, "activate", G_CALLBACK (create_app), NULL);
+ g_signal_connect (application, "startup", G_CALLBACK (create_app), NULL);
+ g_signal_connect (application, "activate", G_CALLBACK (activate), NULL);
context = g_option_context_new (NULL);
g_option_context_add_group (context, gtk_get_option_group (TRUE));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]