From ac1d6d135bda8d739fdb8bf564f89c38b664c097 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 22 Oct 2011 03:08:06 +0000 Subject: De-singleton-ify GUI. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3584 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/PatchTreeWindow.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/gui/PatchTreeWindow.cpp') diff --git a/src/gui/PatchTreeWindow.cpp b/src/gui/PatchTreeWindow.cpp index 0c75dd6a..c728fd2b 100644 --- a/src/gui/PatchTreeWindow.cpp +++ b/src/gui/PatchTreeWindow.cpp @@ -37,6 +37,7 @@ namespace GUI { PatchTreeWindow::PatchTreeWindow(BaseObjectType* cobject, const Glib::RefPtr& xml) : Window(cobject) + , _app(NULL) , _enable_signal(true) { xml->get_widget_derived("patches_treeview", _patches_treeview); @@ -68,8 +69,9 @@ PatchTreeWindow::PatchTreeWindow(BaseObjectType* cobject, } void -PatchTreeWindow::init(ClientStore& store) +PatchTreeWindow::init(App& app, ClientStore& store) { + _app = &app; store.signal_new_object().connect( sigc::mem_fun(this, &PatchTreeWindow::new_object)); } @@ -89,7 +91,7 @@ PatchTreeWindow::add_patch(SharedPtr pm) Gtk::TreeModel::iterator iter = _patch_treestore->append(); Gtk::TreeModel::Row row = *iter; if (pm->path().is_root()) { - row[_patch_tree_columns.name_col] = App::instance().engine()->uri().str(); + row[_patch_tree_columns.name_col] = _app->engine()->uri().str(); } else { row[_patch_tree_columns.name_col] = pm->symbol().c_str(); } @@ -170,7 +172,7 @@ PatchTreeWindow::event_patch_activated(const Gtk::TreeModel::Path& path, Gtk::Tr Gtk::TreeModel::Row row = *active; SharedPtr pm = row[_patch_tree_columns.patch_model_col]; - App::instance().window_factory()->present_patch(pm); + _app->window_factory()->present_patch(pm); } void @@ -184,15 +186,15 @@ PatchTreeWindow::event_patch_enabled_toggled(const Glib::ustring& path_str) assert(pm); if (_enable_signal) - App::instance().engine()->set_property(pm->path(), - App::instance().uris().ingen_enabled, (bool)!pm->enabled()); + _app->engine()->set_property(pm->path(), + _app->uris().ingen_enabled, (bool)!pm->enabled()); } void PatchTreeWindow::patch_property_changed(const URI& key, const Atom& value, SharedPtr patch) { - const URIs& uris = App::instance().uris(); + const URIs& uris = _app->uris(); _enable_signal = false; if (key == uris.ingen_enabled && value.type() == Atom::BOOL) { Gtk::TreeModel::iterator i = find_patch(_patch_treestore->children(), patch); -- cgit v1.2.1