diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index e74b8efe98..5cc72293fb 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -361,9 +361,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir) (void) theme_manager.get (true); - starting.connect (sigc::mem_fun(*this, &ARDOUR_UI::startup)); - stopping.connect (sigc::mem_fun(*this, &ARDOUR_UI::shutdown)); - _process_thread = new ProcessThread (); _process_thread->init (); @@ -536,6 +533,10 @@ ARDOUR_UI::post_engine () ARDOUR_UI::~ARDOUR_UI () { + if (ui_config->dirty()) { + ui_config->save_state(); + } + delete keyboard; delete editor; delete mixer; @@ -712,8 +713,8 @@ ARDOUR_UI::check_announcements () #endif } -void -ARDOUR_UI::startup () +int +ARDOUR_UI::starting () { Application* app = Application::instance (); char *nsm_url; @@ -785,7 +786,7 @@ ARDOUR_UI::startup () s.hide (); switch (s.response ()) { case Gtk::RESPONSE_REJECT: - exit (1); + return -1; default: break; } @@ -799,8 +800,8 @@ ARDOUR_UI::startup () /* go get a session */ - if (get_session_parameters (true, ARDOUR_COMMAND_LINE::new_session, ARDOUR_COMMAND_LINE::load_template)) { - exit (1); + if (get_session_parameters (false, ARDOUR_COMMAND_LINE::new_session, ARDOUR_COMMAND_LINE::load_template)) { + return -1; } } @@ -816,6 +817,7 @@ ARDOUR_UI::startup () _status_bar_visibility.update (); BootMessage (string_compose (_("%1 is ready for use"), PROGRAM_NAME)); + return 0; } void @@ -2618,6 +2620,7 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri should_be_new = false; session_name = session_dialog.session_name (likely_new); + session_path = session_dialog.session_folder (); if (nsm) { likely_new = true; @@ -2640,6 +2643,8 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri _session_is_new = true; } + cerr << "SN " << session_name << " SP " << session_path << endl; + if (session_name[0] == G_DIR_SEPARATOR || (session_name.length() > 2 && session_name[0] == '.' && session_name[1] == G_DIR_SEPARATOR) || (session_name.length() > 3 && session_name[0] == '.' && session_name[1] == '.' && session_name[2] == G_DIR_SEPARATOR)) { @@ -2712,6 +2717,8 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri } else { + cerr << "Loading session with path = " << session_path << " name = " << session_name << " template " << template_name << endl; + ret = load_session (session_path, session_name, template_name); if (ret == -2) { @@ -3771,6 +3778,7 @@ ARDOUR_UI::disconnect_from_engine () /* drop connection to AudioEngine::Halted so that we don't act * as if the engine unexpectedly shut down */ + halt_connection.disconnect (); if (AudioEngine::instance()->stop ()) { @@ -4117,3 +4125,5 @@ ARDOUR_UI::do_audio_midi_setup (uint32_t desired_sample_rate) return -1; } } + + diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 191df0d31d..0253c1ec0a 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -330,8 +330,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr static ARDOUR_UI *theArdourUI; - void startup (); - void shutdown (); + int starting (); int ask_about_saving_session (const std::vector& actions); diff --git a/gtk2_ardour/ardour_ui_dependents.cc b/gtk2_ardour/ardour_ui_dependents.cc index 821382717f..fbfc8c7afd 100644 --- a/gtk2_ardour/ardour_ui_dependents.cc +++ b/gtk2_ardour/ardour_ui_dependents.cc @@ -50,14 +50,6 @@ namespace ARDOUR { using namespace ARDOUR; -void -ARDOUR_UI::shutdown () -{ - if (ui_config->dirty()) { - ui_config->save_state(); - } -} - void ARDOUR_UI::we_have_dependents () {