From e9d9569271ee962c09ab66c6babed1ca5655a6c6 Mon Sep 17 00:00:00 2001
From: David Robillard <d@drobilla.net>
Date: Mon, 12 Mar 2012 02:28:21 +0000
Subject: Unify event response mechanism and make it more appropriate for wire
 transmission.

The downside being more cryptic error messages until the client side error reporting stuff gets more fancy, but the important part is that belongs client side.


git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4053 a436a847-0d15-0410-975c-d299462d15a1
---
 src/gui/App.cpp           | 10 ++++++----
 src/gui/App.hpp           |  3 ++-
 src/gui/ConnectWindow.cpp |  4 ++--
 src/gui/ConnectWindow.hpp |  2 +-
 4 files changed, 11 insertions(+), 8 deletions(-)

(limited to 'src/gui')

diff --git a/src/gui/App.cpp b/src/gui/App.cpp
index 5a42af53..e23ef5a6 100644
--- a/src/gui/App.cpp
+++ b/src/gui/App.cpp
@@ -167,8 +167,8 @@ App::attach(SharedPtr<SigClientInterface> client)
 
 	_patch_tree_window->init(*this, *_store);
 
-	_client->signal_response_error().connect(
-		sigc::mem_fun(this, &App::error_response));
+	_client->signal_response().connect(
+		sigc::mem_fun(this, &App::response));
 	_client->signal_error().connect(
 		sigc::mem_fun(this, &App::error_message));
 	_client->signal_property_change().connect(
@@ -199,9 +199,11 @@ App::serialiser()
 }
 
 void
-App::error_response(int32_t id, const string& str)
+App::response(int32_t id, Status status)
 {
-	error_message(str);
+	if (status) {
+		error_message(ingen_status_string(status));
+	}
 }
 
 void
diff --git a/src/gui/App.hpp b/src/gui/App.hpp
index 69bcd793..5ca767e9 100644
--- a/src/gui/App.hpp
+++ b/src/gui/App.hpp
@@ -28,6 +28,7 @@
 #include "raul/SharedPtr.hpp"
 #include "raul/Deletable.hpp"
 
+#include "ingen/Status.hpp"
 #include "ingen/shared/World.hpp"
 
 namespace Ingen {
@@ -135,7 +136,7 @@ protected:
 	App(Ingen::Shared::World* world);
 
 	bool animate();
-	void error_response(int32_t id, const std::string& str);
+	void response(int32_t id, Ingen::Status status);
 
 	void property_change(const Raul::URI&  subject,
 	                     const Raul::URI&  key,
diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp
index e7a0aba1..0bfa1999 100644
--- a/src/gui/ConnectWindow.cpp
+++ b/src/gui/ConnectWindow.cpp
@@ -369,8 +369,8 @@ ConnectWindow::gtk_callback()
 
 	if (_connect_stage == 0) {
 		_attached = false;
-		_app->client()->signal_response_ok().connect(
-				sigc::mem_fun(this, &ConnectWindow::on_response));
+		_app->client()->signal_response().connect(
+				sigc::mem_fun(this, &ConnectWindow::ingen_response));
 
 		_ping_id = abs(rand()) / 2 * 2; // avoid -1
 		_app->engine()->respond_to(_app->client().get(), _ping_id);
diff --git a/src/gui/ConnectWindow.hpp b/src/gui/ConnectWindow.hpp
index 9f82db32..9905b51a 100644
--- a/src/gui/ConnectWindow.hpp
+++ b/src/gui/ConnectWindow.hpp
@@ -45,7 +45,7 @@ public:
 
 	void set_connected_to(SharedPtr<ServerInterface> engine);
 	void start(App& app, Ingen::Shared::World* world);
-	void on_response(int32_t id) { _attached = true; }
+	void ingen_response(int32_t id, Status status) { _attached = true; }
 
 	bool attached()  const { return _finished_connecting; }
 	bool quit_flag() const { return _quit_flag; }
-- 
cgit v1.2.1