From f9d23955b571e7679aaa90f58be38425bb6fcb2c Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 17 Mar 2007 02:12:40 +0000 Subject: prevent wierd GTK main loop situation when quitting from NSD at startup git-svn-id: svn://localhost/ardour2/trunk@1610 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour_ui.cc | 9 +++++---- gtk2_ardour/ardour_ui.h | 2 +- gtk2_ardour/ardour_ui_ed.cc | 2 +- gtk2_ardour/main.cc | 8 ++++++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 92eb4e1343..46dbe649c7 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -1717,7 +1717,7 @@ ARDOUR_UI::save_template () } } -void +bool ARDOUR_UI::new_session (std::string predetermined_path) { string session_name; @@ -1726,7 +1726,7 @@ ARDOUR_UI::new_session (std::string predetermined_path) if (!engine->connected()) { MessageDialog msg (_("Ardour is not connected to JACK at this time. Creating new sessions is not possible.")); msg.run (); - return; + return false; } int response = Gtk::RESPONSE_NONE; @@ -1743,7 +1743,7 @@ ARDOUR_UI::new_session (std::string predetermined_path) new_session_dialog->hide (); MessageDialog msg (_("Ardour is not connected to JACK at this time. Creating new sessions is not possible.")); msg.run (); - return; + return false; } _session_is_new = false; @@ -1754,7 +1754,7 @@ ARDOUR_UI::new_session (std::string predetermined_path) quit(); } new_session_dialog->hide (); - return; + return false; } else if (response == Gtk::RESPONSE_NONE) { @@ -1929,6 +1929,7 @@ ARDOUR_UI::new_session (std::string predetermined_path) show(); new_session_dialog->get_window()->set_cursor(); new_session_dialog->hide(); + return true; } void diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index dc48856174..246b30edae 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -127,7 +127,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI _will_create_new_session_automatically = yn; } - void new_session(std::string path = string()); + bool new_session(std::string path = string()); gint cmdline_new_session (string path); int unload_session (); void close_session(); diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 3ab6c30e55..211cdcb4ee 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -92,7 +92,7 @@ ARDOUR_UI::install_actions () /* the real actions */ - act = ActionManager::register_action (main_actions, X_("New"), _("New"), bind (mem_fun(*this, &ARDOUR_UI::new_session), string ())); + act = ActionManager::register_action (main_actions, X_("New"), _("New"), hide_return (bind (mem_fun(*this, &ARDOUR_UI::new_session), string ()))); ActionManager::register_action (main_actions, X_("Open"), _("Open"), mem_fun(*this, &ARDOUR_UI::open_session)); ActionManager::register_action (main_actions, X_("Recent"), _("Recent"), mem_fun(*this, &ARDOUR_UI::open_recent_session)); diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc index a3ea0ca4b4..0279c4953e 100644 --- a/gtk2_ardour/main.cc +++ b/gtk2_ardour/main.cc @@ -127,7 +127,9 @@ maybe_load_session () if (!session_name.length()) { ui->hide_splash (); if (!Config->get_no_new_session_dialog()) { - ui->new_session (); + if (!ui->new_session ()) { + return false; + } } return true; @@ -168,7 +170,9 @@ maybe_load_session () /* Show the NSD */ ui->hide_splash (); if (!Config->get_no_new_session_dialog()) { - ui->new_session (); + if (!ui->new_session ()) { + return false; + } } } -- cgit v1.2.3