From d970641441746aacfc645176b71d7ba71af0463a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 24 Jan 2014 00:57:48 +0000 Subject: Update for latest LV2 Atom Object simplifications. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5319 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/App.cpp | 2 +- src/gui/ConnectWindow.cpp | 21 +++++++++++++++++++-- src/gui/ConnectWindow.hpp | 5 ++--- 3 files changed, 22 insertions(+), 6 deletions(-) (limited to 'src/gui') 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 -#include + +#include #include +#include #include @@ -85,6 +87,20 @@ ConnectWindow::start(App& app, Ingen::World* world) connect(bool(world->interface())); } +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 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::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 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(); -- cgit v1.2.1