Merge branch 'nsm' of https://github.com/royvegard/ardour
[ardour.git] / libs / gtkmm2ext / gtkmm2ext / gtk_ui.h
index bba3fb6fdf6b62f03b465e6830636b1dd2163ec1..64176232f05f4a2f36d2cba695fb64217a9e202d 100644 (file)
@@ -83,13 +83,26 @@ struct UIRequest : public BaseUI::BaseRequestObject {
     ~UIRequest () { 
            if (type == ErrorMessage && msg) {
                    /* msg was strdup()'ed */
-                   free ((char *)msg);
+                   free (const_cast<char *>(msg));
            }
     }
 };
 
-class UI : public Receiver, public AbstractUI<UIRequest>
+class UI : public AbstractUI<UIRequest>
 {
+  private:
+       class MyReceiver : public Receiver {
+         public:
+               MyReceiver (UI& ui) : _ui (ui) {}
+               void receive (Transmitter::Channel chn, const char *msg) {
+                       _ui.receive (chn, msg);
+               }
+         private:
+               UI& _ui;
+       };
+
+       MyReceiver _receiver;
+
   public:
        UI (std::string name, int *argc, char **argv[]);
        virtual ~UI ();
@@ -104,8 +117,6 @@ class UI : public Receiver, public AbstractUI<UIRequest>
 
        bool caller_is_ui_thread ();
 
-       static Glib::Thread* thread_id() { return gui_thread; }
-
        /* Gtk-UI specific interfaces */
 
        bool running ();
@@ -148,8 +159,6 @@ class UI : public Receiver, public AbstractUI<UIRequest>
 
        static bool just_hide_it (GdkEventAny *, Gtk::Window *);
 
-       static Glib::Thread* the_gui_thread() { return gui_thread; }
-
   protected:
        virtual void handle_fatal (const char *);
        virtual void display_message (const char *prefix, gint prefix_len,
@@ -158,7 +167,7 @@ class UI : public Receiver, public AbstractUI<UIRequest>
 
   private:
        static UI *theGtkUI;
-       static Glib::Thread* gui_thread;
+
        bool _active;
        Gtk::Main *theMain;
 #ifndef GTK_NEW_TOOLTIP_API
@@ -183,6 +192,7 @@ class UI : public Receiver, public AbstractUI<UIRequest>
        bool color_picked;
 
        void do_request (UIRequest*);
+
 };
 
 } /* namespace */