summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/App.cpp42
-rw-r--r--src/gui/App.hpp3
-rw-r--r--src/gui/BreadCrumbs.cpp12
-rw-r--r--src/gui/BreadCrumbs.hpp1
-rw-r--r--src/gui/ConnectWindow.cpp15
-rw-r--r--src/gui/ConnectWindow.hpp2
6 files changed, 47 insertions, 28 deletions
diff --git a/src/gui/App.cpp b/src/gui/App.cpp
index 15bdc796..789ead6d 100644
--- a/src/gui/App.cpp
+++ b/src/gui/App.cpp
@@ -180,32 +180,12 @@ App::attach(SPtr<SigClientInterface> client)
stderr,
ColorContext::Color::CYAN));
-#define DUMP_CONNECT(signal, method) \
- client->signal_##signal().connect( \
- sigc::mem_fun(*_dumper.get(), &StreamWriter::method));
-
- DUMP_CONNECT(object_deleted, del);
- DUMP_CONNECT(object_moved, move);
- DUMP_CONNECT(put, put);
- DUMP_CONNECT(delta, delta);
- DUMP_CONNECT(connection, connect);
- DUMP_CONNECT(disconnection, disconnect);
- DUMP_CONNECT(disconnect_all, disconnect_all);
- DUMP_CONNECT(property_change, set_property);
-
-#undef DUMP_CONNECT
+ client->signal_message().connect(
+ sigc::mem_fun(*_dumper.get(), &StreamWriter::message));
}
_graph_tree_window->init(*this, *_store);
-
- _client->signal_response().connect(
- sigc::mem_fun(this, &App::response));
- _client->signal_error().connect(
- sigc::mem_fun(this, &App::error_message));
- _client->signal_put().connect(
- sigc::mem_fun(this, &App::put));
- _client->signal_property_change().connect(
- sigc::mem_fun(this, &App::property_change));
+ _client->signal_message().connect(sigc::mem_fun(this, &App::message));
}
void
@@ -238,6 +218,20 @@ App::serialiser()
}
void
+App::message(const Message& msg)
+{
+ if (const Response* const r = boost::get<Response>(&msg)) {
+ response(r->id, r->status, r->subject);
+ } else if (const Error* const e = boost::get<Error>(&msg)) {
+ error_message(e->message);
+ } else if (const Put* const p = boost::get<Put>(&msg)) {
+ put(p->uri, p->properties, p->ctx);
+ } else if (const SetProperty* const s = boost::get<SetProperty>(&msg)) {
+ property_change(s->subject, s->predicate, s->value, s->ctx);
+ }
+}
+
+void
App::response(int32_t id, Status status, const std::string& subject)
{
if (status != Status::SUCCESS) {
@@ -269,7 +263,7 @@ App::set_property(const Raul::URI& subject,
went as planned here and fire the signal ourselves as if the server
feedback came back immediately. */
if (key != uris().ingen_activity) {
- _client->signal_property_change().emit(subject, key, value, ctx);
+ _client->signal_message().emit(SetProperty{subject, key, value, ctx});
}
}
diff --git a/src/gui/App.hpp b/src/gui/App.hpp
index 6dcab171..e226751b 100644
--- a/src/gui/App.hpp
+++ b/src/gui/App.hpp
@@ -25,6 +25,7 @@
#include <gtkmm/window.h>
#include "ingen/Atom.hpp"
+#include "ingen/Message.hpp"
#include "ingen/Resource.hpp"
#include "ingen/Status.hpp"
#include "ingen/World.hpp"
@@ -141,6 +142,8 @@ public:
protected:
explicit App(Ingen::World* world);
+ void message(const Ingen::Message& msg);
+
bool animate();
void response(int32_t id, Ingen::Status status, const std::string& subject);
diff --git a/src/gui/BreadCrumbs.cpp b/src/gui/BreadCrumbs.cpp
index 447b06ba..c62a1e06 100644
--- a/src/gui/BreadCrumbs.cpp
+++ b/src/gui/BreadCrumbs.cpp
@@ -33,8 +33,8 @@ BreadCrumbs::BreadCrumbs(App& app)
, _full_path("/")
, _enable_signal(true)
{
- app.client()->signal_object_deleted().connect(
- sigc::mem_fun(this, &BreadCrumbs::object_destroyed));
+ app.client()->signal_message().connect(
+ sigc::mem_fun(this, &BreadCrumbs::message));
set_can_focus(false);
}
@@ -180,6 +180,14 @@ BreadCrumbs::breadcrumb_clicked(BreadCrumb* crumb)
}
void
+BreadCrumbs::message(const Message& msg)
+{
+ if (const Del* const del = boost::get<Del>(&msg)) {
+ object_destroyed(del->uri);
+ }
+}
+
+void
BreadCrumbs::object_destroyed(const Raul::URI& uri)
{
for (auto i = _breadcrumbs.begin(); i != _breadcrumbs.end(); ++i) {
diff --git a/src/gui/BreadCrumbs.hpp b/src/gui/BreadCrumbs.hpp
index e58b2c0f..22bbd7af 100644
--- a/src/gui/BreadCrumbs.hpp
+++ b/src/gui/BreadCrumbs.hpp
@@ -103,6 +103,7 @@ private:
void breadcrumb_clicked(BreadCrumb* crumb);
+ void message(const Message& msg);
void object_destroyed(const Raul::URI& uri);
void object_moved(const Raul::Path& old_path, const Raul::Path& new_path);
diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp
index 0b4ea298..635df134 100644
--- a/src/gui/ConnectWindow.cpp
+++ b/src/gui/ConnectWindow.cpp
@@ -19,6 +19,7 @@
#include <sstream>
#include <string>
+#include <boost/variant.hpp>
#include <gtkmm/stock.h>
#include "raul/Process.hpp"
@@ -74,6 +75,16 @@ ConnectWindow::ConnectWindow(BaseObjectType* cobject,
}
void
+ConnectWindow::message(const Message& msg)
+{
+ if (const Response* const r = boost::get<Response>(&msg)) {
+ ingen_response(r->id, r->status, r->subject);
+ } else if (const Error* const e = boost::get<Error>(&msg)) {
+ error(e->message);
+ }
+}
+
+void
ConnectWindow::error(const std::string& msg)
{
if (!is_visible()) {
@@ -477,8 +488,8 @@ ConnectWindow::gtk_callback()
}
} else if (_connect_stage == 1) {
_attached = false;
- _app->client()->signal_response().connect(
- sigc::mem_fun(this, &ConnectWindow::ingen_response));
+ _app->client()->signal_message().connect(
+ sigc::mem_fun(this, &ConnectWindow::message));
_ping_id = g_random_int_range(1, std::numeric_limits<int32_t>::max());
_app->interface()->set_response_id(_ping_id);
diff --git a/src/gui/ConnectWindow.hpp b/src/gui/ConnectWindow.hpp
index 5b68c597..560bd82b 100644
--- a/src/gui/ConnectWindow.hpp
+++ b/src/gui/ConnectWindow.hpp
@@ -58,6 +58,8 @@ public:
private:
enum class Mode { CONNECT_REMOTE, LAUNCH_REMOTE, INTERNAL };
+ void message(const Message& message);
+
void error(const std::string& msg);
void ingen_response(int32_t id, Status status, const std::string& subject);