[tali] Disallow creation of multiple windows
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tali] Disallow creation of multiple windows
- Date: Thu, 25 Sep 2014 22:35:51 +0000 (UTC)
commit 4900022d4ccb1a8cf84a784ebc8b9c73d6b2aa00
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Thu Sep 25 17:34:54 2014 -0500
Disallow creation of multiple windows
src/gyahtzee.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/gyahtzee.c b/src/gyahtzee.c
index 65f45f9..45e03f8 100644
--- a/src/gyahtzee.c
+++ b/src/gyahtzee.c
@@ -843,10 +843,15 @@ GyahtzeeCreateMainWindow (GApplication *app, gpointer user_data)
gtk_widget_show (hbox);
gtk_widget_show (vbox);
+}
- gtk_widget_show (window);
-
- GyahtzeeNewGame ();
+static void
+GyahtzeeActivateGame (GApplication *app, gpointer user_data)
+{
+ if (!gtk_widget_is_visible (window)) {
+ gtk_widget_show (window);
+ GyahtzeeNewGame ();
+ }
}
int
@@ -865,7 +870,8 @@ main (int argc, char *argv[])
textdomain (GETTEXT_PACKAGE);
application = gtk_application_new ("org.gnome.tali", 0);
- g_signal_connect (application, "activate", G_CALLBACK (GyahtzeeCreateMainWindow), NULL);
+ g_signal_connect (application, "startup", G_CALLBACK (GyahtzeeCreateMainWindow), NULL);
+ g_signal_connect (application, "activate", G_CALLBACK (GyahtzeeActivateGame), NULL);
games_scores_startup ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]