diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2013-07-11 12:52:46 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2013-07-11 12:52:46 -0400 |
commit | 7626cd68ac033de3ebaa0bf60ce4bdbf7da44329 (patch) | |
tree | b3d8c3fa5d120ef7e47e85d2e59f7683400555e9 /libs | |
parent | 5d20b3e24eefc55b575d3703667d4a87e6491028 (diff) |
Hide UI request mechanism from inheriting classes
Diffstat (limited to 'libs')
-rw-r--r-- | libs/gtkmm2ext/gtk_ui.cc | 2 | ||||
-rw-r--r-- | libs/pbd/base_ui.cc | 17 | ||||
-rw-r--r-- | libs/pbd/pbd/abstract_ui.cc | 2 | ||||
-rw-r--r-- | libs/pbd/pbd/base_ui.h | 6 |
4 files changed, 21 insertions, 6 deletions
diff --git a/libs/gtkmm2ext/gtk_ui.cc b/libs/gtkmm2ext/gtk_ui.cc index 6e466f5c9f..ee5e0c07f6 100644 --- a/libs/gtkmm2ext/gtk_ui.cc +++ b/libs/gtkmm2ext/gtk_ui.cc @@ -94,7 +94,7 @@ UI::UI (string namestr, int *argc, char ***argv) /* attach our request source to the default main context */ - request_channel.ios()->attach (MainContext::get_default()); + attach_request_source (MainContext::get_default()); errors = new TextViewer (800,600); errors->text().set_editable (false); diff --git a/libs/pbd/base_ui.cc b/libs/pbd/base_ui.cc index 69b156589f..35ea6078ee 100644 --- a/libs/pbd/base_ui.cc +++ b/libs/pbd/base_ui.cc @@ -42,9 +42,9 @@ BaseUI::RequestType BaseUI::CallSlot = BaseUI::new_request_type(); BaseUI::RequestType BaseUI::Quit = BaseUI::new_request_type(); BaseUI::BaseUI (const string& str) - : request_channel (true) - , run_loop_thread (0) + : run_loop_thread (0) , _name (str) + , request_channel (true) { base_ui_instance = this; @@ -138,4 +138,15 @@ BaseUI::request_handler (Glib::IOCondition ioc) return true; } - + +void +BaseUI::signal_new_request () +{ + request_channel.wakeup (); +} + +void +BaseUI::attach_request_source (Glib::RefPtr<Glib::MainContext> context) +{ + request_channel.ios()->attach (context); +} diff --git a/libs/pbd/pbd/abstract_ui.cc b/libs/pbd/pbd/abstract_ui.cc index 64fd718dbc..02b42fdead 100644 --- a/libs/pbd/pbd/abstract_ui.cc +++ b/libs/pbd/pbd/abstract_ui.cc @@ -349,7 +349,7 @@ AbstractUI<RequestObject>::send_request (RequestObject *req) at the per-thread and generic request lists. */ - request_channel.wakeup (); + signal_new_request (); } } diff --git a/libs/pbd/pbd/base_ui.h b/libs/pbd/pbd/base_ui.h index 186a3c55a6..22784c9bfc 100644 --- a/libs/pbd/pbd/base_ui.h +++ b/libs/pbd/pbd/base_ui.h @@ -71,7 +71,6 @@ class BaseUI : public sigc::trackable, public PBD::EventLoop void quit (); protected: - CrossThreadChannel request_channel; bool _ok; Glib::RefPtr<Glib::MainLoop> _main_loop; @@ -96,6 +95,9 @@ class BaseUI : public sigc::trackable, public PBD::EventLoop */ bool request_handler (Glib::IOCondition); + void signal_new_request (); + void attach_request_source (Glib::RefPtr<Glib::MainContext> context); + /** Derived UI objects must implement this method, * which will be called whenever there are requests * to be dealt with. @@ -105,6 +107,8 @@ class BaseUI : public sigc::trackable, public PBD::EventLoop private: std::string _name; BaseUI* base_ui_instance; + + CrossThreadChannel request_channel; static uint64_t rt_bit; |