X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fgtkmm2ext%2Fgtk_ui.cc;h=d1601468591945033b5954fd07887ef28eed3d1c;hb=4b9e7386360746232dbdf2609b4e23ef02b0c5e9;hp=92756c47827c5aaf550bfcd66bbfea4123049b9e;hpb=44cd222eb2c45e1496a6e4efd263ce088739a608;p=ardour.git diff --git a/libs/gtkmm2ext/gtk_ui.cc b/libs/gtkmm2ext/gtk_ui.cc index 92756c4782..d160146859 100644 --- a/libs/gtkmm2ext/gtk_ui.cc +++ b/libs/gtkmm2ext/gtk_ui.cc @@ -27,20 +27,23 @@ #include #include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include + +#include "pbd/error.h" +#include "pbd/touchable.h" +#include "pbd/failed_constructor.h" +#include "pbd/pthread_utils.h" +#include "pbd/replace_all.h" + +#include "gtkmm2ext/application.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" @@ -62,26 +65,33 @@ BaseUI::RequestType Gtkmm2ext::AddTimeout = BaseUI::new_request_type(); #include "pbd/abstract_ui.cc" /* instantiate the template */ +template class AbstractUI; + UI::UI (string namestr, int *argc, char ***argv) : AbstractUI (namestr) + , _receiver (*this) + , 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, which is assumed to have called this. */ - run_loop_thread = Thread::self(); - + run_loop_thread = Threads::Thread::self(); + /* store "this" as the UI-for-thread of this thread, same argument as for previous line. */ @@ -90,7 +100,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 (); errors = new TextViewer (800,600); errors->text().set_editable (false); @@ -116,13 +126,14 @@ UI::UI (string namestr, int *argc, char ***argv) UI::~UI () { + _receiver.hangup (); + delete (errors); } - bool UI::caller_is_ui_thread () { - return Thread::self() == run_loop_thread; + return Threads::Thread::self() == run_loop_thread; } int @@ -131,9 +142,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