[gnome-games] application: Quit on SIGINT
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] application: Quit on SIGINT
- Date: Fri, 25 Mar 2016 12:53:21 +0000 (UTC)
commit 02326f538cd9fbba1ccf2e22e3fd245da77dd14d
Author: Adrien Plazas <kekun plazas laposte net>
Date: Sun Mar 6 19:36:27 2016 +0100
application: Quit on SIGINT
This will be used to safely quit a game when a SIGINT occures.
src/ui/application.vala | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/ui/application.vala b/src/ui/application.vala
index eb042d7..0a44adc 100644
--- a/src/ui/application.vala
+++ b/src/ui/application.vala
@@ -31,6 +31,7 @@ private class Games.Application : Gtk.Application {
construct {
add_actions ();
+ add_signal_handlers ();
}
private void add_actions () {
@@ -47,6 +48,16 @@ private class Games.Application : Gtk.Application {
add_action (quit_action);
}
+ private void add_signal_handlers () {
+ var interrupt_source = new Unix.SignalSource (ProcessSignal.INT);
+ interrupt_source.set_callback (() => {
+ quit ();
+
+ return Source.CONTINUE;
+ });
+ interrupt_source.attach (MainContext default ());
+ }
+
public static string get_data_dir () {
var data_dir = Environment.get_user_data_dir ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]