X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fgtkmm2ext%2Fgtk_ui.cc;h=0da843804583a468b058aae3c5ce969dff773e21;hb=dec10f2f3c6fffe27e72243d9bf36713d8f084f9;hp=d9e4c871a65be903f7bad202c67be638e82998d6;hpb=5265ceec51c73983d9883786611de4340f0baf03;p=ardour.git diff --git a/libs/gtkmm2ext/gtk_ui.cc b/libs/gtkmm2ext/gtk_ui.cc index d9e4c871a6..0da8438045 100644 --- a/libs/gtkmm2ext/gtk_ui.cc +++ b/libs/gtkmm2ext/gtk_ui.cc @@ -35,16 +35,17 @@ #include "pbd/replace_all.h" #include "gtkmm2ext/application.h" +#include "gtkmm2ext/bindings.h" #include "gtkmm2ext/gtk_ui.h" #include "gtkmm2ext/textviewer.h" -#include "gtkmm2ext/popup.h" #include "gtkmm2ext/utils.h" #include "gtkmm2ext/window_title.h" #include "gtkmm2ext/actions.h" #include "gtkmm2ext/activatable.h" #include "gtkmm2ext/actions.h" +#include "gtkmm2ext/gui_thread.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace Gtkmm2ext; using namespace Gtk; @@ -52,7 +53,7 @@ using namespace Glib; using namespace PBD; using std::map; -UI *UI::theGtkUI = 0; +UI* UI::theGtkUI = 0; BaseUI::RequestType Gtkmm2ext::NullMessage = BaseUI::new_request_type(); BaseUI::RequestType Gtkmm2ext::ErrorMessage = BaseUI::new_request_type(); @@ -64,20 +65,25 @@ BaseUI::RequestType Gtkmm2ext::AddTimeout = BaseUI::new_request_type(); #include "pbd/abstract_ui.cc" /* instantiate the template */ -UI::UI (string namestr, int *argc, char ***argv) - : AbstractUI (namestr) +template class AbstractUI; + +UI::UI (string application_name, string thread_name, int *argc, char ***argv) + : AbstractUI (thread_name) , _receiver (*this) - + , global_bindings (0) + , errors (0) { theMain = new Main (argc, argv); + pthread_set_name ("gui"); + _active = false; if (!theGtkUI) { theGtkUI = this; } else { fatal << "duplicate UI requested" << endmsg; - /* NOTREACHED */ + abort(); /* NOTREACHED */ } /* the GUI event loop runs in the main thread of the app, @@ -85,23 +91,27 @@ UI::UI (string namestr, int *argc, char ***argv) */ run_loop_thread = Threads::Thread::self(); - + /* store "this" as the UI-for-thread of this thread, same argument as for previous line. */ set_event_loop_for_thread (this); + /* we will be receiving requests */ + + EventLoop::register_request_buffer_factory ("gui", request_buffer_factory); + /* attach our request source to the default main context */ - request_channel.ios()->attach (MainContext::get_default()); + attach_request_source (); errors = new TextViewer (800,600); errors->text().set_editable (false); errors->text().set_name ("ErrorText"); errors->signal_unmap().connect (sigc::bind (sigc::ptr_fun (&ActionManager::uncheck_toggleaction), X_("/Editor/toggle-log-window"))); - Glib::set_application_name(namestr); + Glib::set_application_name (application_name); WindowTitle title(Glib::get_application_name()); title += _("Log"); @@ -121,6 +131,7 @@ UI::UI (string namestr, int *argc, char ***argv) UI::~UI () { _receiver.hangup (); + delete (errors); } bool @@ -135,9 +146,9 @@ UI::load_rcfile (string path, bool themechange) /* Yes, pointers to Glib::RefPtr. If these are not kept around, * a segfault somewhere deep in the wonderfully robust glib will result. * This does not occur if wiget.get_style is used instead of rc.get_style below, - * except that doesn't actually work... + * except that doesn't actually work... */ - + static Glib::RefPtr