13
0

Hide UI request mechanism from inheriting classes

This commit is contained in:
Paul Davis 2013-07-11 12:52:46 -04:00
parent 5d20b3e24e
commit 7626cd68ac
4 changed files with 21 additions and 6 deletions

View File

@ -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);

View File

@ -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);
}

View File

@ -349,7 +349,7 @@ AbstractUI<RequestObject>::send_request (RequestObject *req)
at the per-thread and generic request lists.
*/
request_channel.wakeup ();
signal_new_request ();
}
}

View File

@ -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;