summaryrefslogtreecommitdiffstats
path: root/src/gui/App.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-01-07 04:23:22 +0000
committerDavid Robillard <d@drobilla.net>2010-01-07 04:23:22 +0000
commit5f58582a4a9aebb3c223e7132d24a278ce29e1cb (patch)
treeec33e676afc2f9285ddf14cdbcf7a107e8a24c0e /src/gui/App.cpp
parent2d3e27ef80e4fc8704390ea7a878068b5ae6a370 (diff)
downloadingen-5f58582a4a9aebb3c223e7132d24a278ce29e1cb.tar.gz
ingen-5f58582a4a9aebb3c223e7132d24a278ce29e1cb.tar.bz2
ingen-5f58582a4a9aebb3c223e7132d24a278ce29e1cb.zip
Quit cleanly from connect dialog when not connected to engine.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2357 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui/App.cpp')
-rw-r--r--src/gui/App.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/gui/App.cpp b/src/gui/App.cpp
index 9391200d..c2cde0ed 100644
--- a/src/gui/App.cpp
+++ b/src/gui/App.cpp
@@ -143,7 +143,8 @@ App::init(Ingen::Shared::World* world)
// (otherwise with 'ingen -egl' we'll get a bunch of notifications about load immediately
// before even knowing about the root patch or plugins)
while (!App::instance().connect_window()->attached())
- _main->iteration();
+ if (_main->iteration())
+ break;
}
@@ -314,10 +315,29 @@ App::show_about()
}
-void
-App::quit()
+/** Prompt (if necessary) and quit application (if confirmed).
+ * @return true iff the application quit.
+ */
+bool
+App::quit(Gtk::Window& dialog_parent)
{
- Gtk::Main::quit();
+ bool quit = true;
+ if (App::instance().world()->local_engine) {
+ Gtk::MessageDialog d(dialog_parent,
+ "The engine is running in this process. Quitting will terminate Ingen."
+ "\n\n" "Are you sure you want to quit?",
+ true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE, true);
+ d.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
+ d.add_button(Gtk::Stock::QUIT, Gtk::RESPONSE_CLOSE);
+ quit = (d.run() == Gtk::RESPONSE_CLOSE);
+ }
+
+ if (quit)
+ Gtk::Main::quit();
+
+ //App::instance().engine()->quit();
+
+ return quit;
}