summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIain Buclaw <iain.buclaw@sociomantic.com>2018-09-27 16:59:38 +0200
committerIain Buclaw <iain.buclaw@sociomantic.com>2018-09-27 16:59:38 +0200
commit944e00b3a3c6a66d27425919e9ab8253cabeaf06 (patch)
treec64424c832de8955144237deee6679d8e7bfb9fa
parent49279ad7a1463b13b82162fa18b76797595a2962 (diff)
fix #501: Add hook to signal_delete_event, ensure proper destruction of window
-rw-r--r--src/main_window.cc10
-rw-r--r--src/main_window.hh1
2 files changed, 11 insertions, 0 deletions
diff --git a/src/main_window.cc b/src/main_window.cc
index d82415e..0191b5a 100644
--- a/src/main_window.cc
+++ b/src/main_window.cc
@@ -203,6 +203,10 @@ namespace Astroid {
update_title_dispatcher.connect (
sigc::mem_fun (this, &MainWindow::on_update_title));
+ /* catch window close events */
+ signal_delete_event ().connect (
+ sigc::mem_fun (this, &MainWindow::on_delete_event));
+
/* register keys {{{ */
keys.title = "MainWindow";
@@ -637,6 +641,12 @@ namespace Astroid {
close (); // Gtk::Window::close ()
}
+ bool MainWindow::on_delete_event (GdkEventAny *) {
+ if (!in_quit)
+ quit ();
+ return false;
+ }
+
void MainWindow::on_yes () {
answer_yes_no (true);
}
diff --git a/src/main_window.hh b/src/main_window.hh
index c1f6a31..1cf174e 100644
--- a/src/main_window.hh
+++ b/src/main_window.hh
@@ -117,6 +117,7 @@ namespace Astroid {
void set_title (ustring);
void quit ();
+ bool on_delete_event (GdkEventAny *);
Glib::Dispatcher update_title_dispatcher;