Hide UI request mechanism from inheriting classes
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 11 Jul 2013 16:52:46 +0000 (12:52 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 11 Jul 2013 16:52:46 +0000 (12:52 -0400)
libs/gtkmm2ext/gtk_ui.cc
libs/pbd/base_ui.cc
libs/pbd/pbd/abstract_ui.cc
libs/pbd/pbd/base_ui.h

index 6e466f5c9f587b5a120b7406254e2e37653566be..ee5e0c07f6ad019d4128fbff08ba849c3078bf07 100644 (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);
index 69b156589fd7c46709024a8e251ab934aa0dfdd8..35ea6078ee71415ca6ba50f7fcf8a18f60c1c2ab 100644 (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);
+}
index 64fd718dbc457a559ed3492ae5685acb69329160..02b42fdead6ebc827e8909ce76c4f942096ff76c 100644 (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 ();
        }
 }
 
index 186a3c55a659e346c7e723d5a2ba4f457adf5623..22784c9bfc22ca9083acbb74a57185e1a41180e3 100644 (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;