diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/App.cpp | 2 | ||||
-rw-r--r-- | src/gui/ConnectWindow.cpp | 21 | ||||
-rw-r--r-- | src/gui/ConnectWindow.hpp | 5 |
3 files changed, 22 insertions, 6 deletions
diff --git a/src/gui/App.cpp b/src/gui/App.cpp index 1b71cf06..719fe694 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -335,7 +335,7 @@ bool App::quit(Gtk::Window* dialog_parent) { bool quit = true; - if (_world->engine()) { + if (_world->engine() && _connect_window->attached()) { Gtk::MessageDialog d( "The engine is running in this process. Quitting will terminate Ingen." "\n\n" "Are you sure you want to quit?", diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index ca4836b7..6c1b5827 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -15,8 +15,10 @@ */ #include <stdlib.h> -#include <string> + +#include <limits> #include <sstream> +#include <string> #include <gtkmm/stock.h> @@ -86,6 +88,20 @@ ConnectWindow::start(App& app, Ingen::World* world) } void +ConnectWindow::ingen_response(int32_t id, + Status status, + const std::string& subject) +{ + if (id == _ping_id) { + if (status != Status::SUCCESS) { + _app->world()->log().error("Failed to get root patch\n"); + } else { + _attached = true; + } + } +} + +void ConnectWindow::set_connected_to(SPtr<Ingen::Interface> engine) { _app->world()->set_interface(engine); @@ -388,7 +404,7 @@ ConnectWindow::gtk_callback() _app->client()->signal_response().connect( sigc::mem_fun(this, &ConnectWindow::ingen_response)); - _ping_id = g_random_int(); + _ping_id = g_random_int_range(1, std::numeric_limits<int32_t>::max()); _app->interface()->set_response_id(_ping_id); _app->interface()->get(Raul::URI("ingen:/engine")); @@ -436,6 +452,7 @@ ConnectWindow::gtk_callback() _progress_label->set_text("Connected to engine"); _connect_stage = 0; // set ourselves up for next time (if there is one) _finished_connecting = true; + _app->interface()->set_response_id(-1); return false; // deregister this callback } diff --git a/src/gui/ConnectWindow.hpp b/src/gui/ConnectWindow.hpp index 2efa394f..5e375342 100644 --- a/src/gui/ConnectWindow.hpp +++ b/src/gui/ConnectWindow.hpp @@ -51,9 +51,6 @@ public: void set_connected_to(SPtr<Ingen::Interface> engine); void start(App& app, Ingen::World* world); - void ingen_response(int32_t id, Status status, const std::string& subject) { - _attached = true; - } bool attached() const { return _finished_connecting; } bool quit_flag() const { return _quit_flag; } @@ -61,6 +58,8 @@ public: private: enum class Mode { CONNECT_REMOTE, LAUNCH_REMOTE, INTERNAL }; + void ingen_response(int32_t id, Status status, const std::string& subject); + void server_toggled(); void launch_toggled(); void internal_toggled(); |