summaryrefslogtreecommitdiffstats
path: root/src/libs/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/gui')
-rw-r--r--src/libs/gui/App.cpp25
-rw-r--r--src/libs/gui/App.hpp21
-rw-r--r--src/libs/gui/ThreadedLoader.cpp17
-rw-r--r--src/libs/gui/ThreadedLoader.hpp3
4 files changed, 45 insertions, 21 deletions
diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp
index 255af745..ef81b0cc 100644
--- a/src/libs/gui/App.cpp
+++ b/src/libs/gui/App.cpp
@@ -65,12 +65,27 @@ App* App::_instance = 0;
App::App(Ingen::Shared::World* world)
-: _configuration(new Configuration()),
- _about_dialog(NULL),
- _window_factory(new WindowFactory()),
- _world(world),
- _enable_signal(true)
+ : _serialisation_module(Ingen::Shared::load_module("ingen_serialisation"))
+ , _configuration(new Configuration())
+ , _about_dialog(NULL)
+ , _window_factory(new WindowFactory())
+ , _world(world)
+ , _enable_signal(true)
{
+ if (_serialisation_module) {
+ Serialiser* (*new_serialiser)(Ingen::Shared::World*) = NULL;
+
+ bool found = _serialisation_module->get_symbol("new_serialiser", (void*&)new_serialiser);
+
+ if (found)
+ _serialiser = SharedPtr<Serialiser>(new_serialiser(world));
+ }
+
+ if ( ! _serialiser) {
+ cerr << "WARNING: Failed to load ingen_serialisation module, save disabled." << endl;
+ cerr << "(If you are running from the source tree, source set_dev_environment.sh)" << endl;
+ }
+
Glib::RefPtr<Gnome::Glade::Xml> glade_xml = GladeFactory::new_glade_reference();
glade_xml->get_widget_derived("connect_win", _connect_window);
diff --git a/src/libs/gui/App.hpp b/src/libs/gui/App.hpp
index 7629cd0e..196bdd96 100644
--- a/src/libs/gui/App.hpp
+++ b/src/libs/gui/App.hpp
@@ -43,9 +43,14 @@ namespace Ingen {
class Store;
class SigClientInterface;
}
+ namespace Serialisation {
+ class Serialiser;
+ }
}
+
+using namespace Ingen::Shared;
+using namespace Ingen::Serialisation;
using namespace Ingen::Client;
-using Ingen::Shared::EngineInterface;
/** \defgroup GUI GTK GUI
*/
@@ -94,10 +99,13 @@ public:
Configuration* configuration() const { return _configuration; }
WindowFactory* window_factory() const { return _window_factory; }
- const SharedPtr<EngineInterface>& engine() const { return _engine; }
- const SharedPtr<SigClientInterface>& client() const { return _client; }
- const SharedPtr<Store>& store() const { return _store; }
- const SharedPtr<ThreadedLoader>& loader() const { return _loader; }
+ const SharedPtr<EngineInterface>& engine() const { return _engine; }
+ const SharedPtr<SigClientInterface>& client() const { return _client; }
+ const SharedPtr<Store>& store() const { return _store; }
+ const SharedPtr<ThreadedLoader>& loader() const { return _loader; }
+ const SharedPtr<Serialiser>& serialiser() const { return _serialiser; }
+
+ SharedPtr<Glib::Module> serialisation_module() { return _serialisation_module; }
static inline App& instance() { assert(_instance); return *_instance; }
@@ -115,10 +123,13 @@ protected:
static App* _instance;
+ SharedPtr<Glib::Module> _serialisation_module;
+
SharedPtr<EngineInterface> _engine;
SharedPtr<SigClientInterface> _client;
SharedPtr<Store> _store;
SharedPtr<ThreadedLoader> _loader;
+ SharedPtr<Serialiser> _serialiser;
Configuration* _configuration;
diff --git a/src/libs/gui/ThreadedLoader.cpp b/src/libs/gui/ThreadedLoader.cpp
index a1c28acf..11a2bcd7 100644
--- a/src/libs/gui/ThreadedLoader.cpp
+++ b/src/libs/gui/ThreadedLoader.cpp
@@ -29,17 +29,18 @@ namespace GUI {
ThreadedLoader::ThreadedLoader(SharedPtr<EngineInterface> engine)
- : _serialisation_module(Ingen::Shared::load_module("ingen_serialisation"))
- , _engine(engine)
+ : _engine(engine)
, _deprecated_loader(engine)
- , _serializer(*App::instance().world()->rdf_world)
{
set_name("Loader");
// FIXME: rework this so the thread is only present when it's doing something (save mem)
- if (_serialisation_module) {
+ if (App::instance().serialisation_module()) {
Loader* (*new_loader)() = NULL;
- bool found = _serialisation_module->get_symbol("new_loader", (void*&)new_loader);
+
+ bool found = App::instance().serialisation_module()->get_symbol(
+ "new_loader", (void*&)new_loader);
+
if (found)
_loader = SharedPtr<Loader>(new_loader());
}
@@ -47,8 +48,8 @@ ThreadedLoader::ThreadedLoader(SharedPtr<EngineInterface> engine)
if (_loader) {
start();
} else {
- cerr << "WARNING: Failed to load ingen_serialisation module, unable to load patches." << endl;;
- cerr << "If you are running from the source tree, run ingenuity_dev." << endl;
+ cerr << "WARNING: Failed to load ingen_serialisation module, load disabled." << endl;
+ cerr << "(If you are running from the source tree, source set_dev_environment.sh)" << endl;
}
}
@@ -126,7 +127,7 @@ ThreadedLoader::save_patch(SharedPtr<PatchModel> model, const string& filename)
void
ThreadedLoader::save_patch_event(SharedPtr<PatchModel> model, const string& filename)
{
- _serializer.to_file(model, filename);
+ App::instance().serialiser()->to_file(model, filename);
}
diff --git a/src/libs/gui/ThreadedLoader.hpp b/src/libs/gui/ThreadedLoader.hpp
index d0f171af..2e03c2a1 100644
--- a/src/libs/gui/ThreadedLoader.hpp
+++ b/src/libs/gui/ThreadedLoader.hpp
@@ -79,13 +79,10 @@ private:
void _whipped();
- SharedPtr<Glib::Module> _serialisation_module;
-
SharedPtr<EngineInterface> _engine;
SharedPtr<Loader> _loader;
DeprecatedLoader _deprecated_loader;
- Serialiser _serializer;
Glib::Mutex _mutex;
list<Closure> _events;
};