[aisleriot] app: Add some safety checks
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [aisleriot] app: Add some safety checks
- Date: Mon, 4 Mar 2013 20:37:16 +0000 (UTC)
commit 43964397f512836c932dbf01590d3683e788d9c9
Author: Christian Persch <chpe gnome org>
Date: Mon Mar 4 21:22:51 2013 +0100
app: Add some safety checks
src/ar-application.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/ar-application.c b/src/ar-application.c
index 1a945b2..0515126 100644
--- a/src/ar-application.c
+++ b/src/ar-application.c
@@ -74,6 +74,9 @@ action_new_game (GSimpleAction *action,
GtkWindow *window;
window = gtk_application_get_active_window (application);
+ if (!AISLERIOT_IS_WINDOW (window))
+ return;
+
aisleriot_window_new_game (AISLERIOT_WINDOW (window));
}
@@ -86,6 +89,9 @@ action_change_game (GSimpleAction *action,
GtkWindow *window;
window = gtk_application_get_active_window (application);
+ if (!AISLERIOT_IS_WINDOW (window))
+ return;
+
aisleriot_window_change_game (AISLERIOT_WINDOW (window));
}
@@ -99,6 +105,9 @@ action_fullscreen (GSimpleAction *action,
GdkWindowState state;
window = gtk_application_get_active_window (application);
+ if (!AISLERIOT_IS_WINDOW (window))
+ return;
+
state = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (window)));
if (state & GDK_WINDOW_STATE_FULLSCREEN)
gtk_window_unfullscreen (window);
@@ -115,6 +124,9 @@ action_statistics (GSimpleAction *action,
GtkWindow *window;
window = gtk_application_get_active_window (application);
+ if (!AISLERIOT_IS_WINDOW (window))
+ return;
+
aisleriot_window_show_statistics_dialog (AISLERIOT_WINDOW (window));
}
@@ -140,6 +152,9 @@ action_help (GSimpleAction *action,
const char *game_module;
window = gtk_application_get_active_window (application);
+ if (!AISLERIOT_IS_WINDOW (window))
+ return;
+
game_module = aisleriot_window_get_game_module (AISLERIOT_WINDOW (window));
aisleriot_show_help (GTK_WIDGET (window), game_module);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]