summaryrefslogtreecommitdiffstats
path: root/src/gui/ConnectWindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/ConnectWindow.cpp')
-rw-r--r--src/gui/ConnectWindow.cpp21
1 files changed, 19 insertions, 2 deletions
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
}