summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2020-03-05 17:34:41 -0700
committerPaul Davis <paul@linuxaudiosystems.com>2020-03-05 17:34:41 -0700
commit86045fe5268811233b7267a46a88179b1c56c8b7 (patch)
treedd16880a9963593bdb2bbd0241088521ce8f65ce /gtk2_ardour
parentf04974aa6cb93de18be6a48c40e8ce15d738aaf6 (diff)
move more or less all responsibility for ShouldLoad (macOS, NSM) back into ARDOUR_UI
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/ardour_ui_startup.cc19
-rw-r--r--gtk2_ardour/startup_fsm.cc18
-rw-r--r--gtk2_ardour/startup_fsm.h2
3 files changed, 18 insertions, 21 deletions
diff --git a/gtk2_ardour/ardour_ui_startup.cc b/gtk2_ardour/ardour_ui_startup.cc
index c555ce43da..6178282a21 100644
--- a/gtk2_ardour/ardour_ui_startup.cc
+++ b/gtk2_ardour/ardour_ui_startup.cc
@@ -474,6 +474,8 @@ ARDOUR_UI::starting ()
{
Application* app = Application::instance();
+ app->ShouldLoad.connect (sigc::mem_fun (*this, &ARDOUR_UI::load_from_application_api));
+
if (ARDOUR_COMMAND_LINE::check_announcements) {
check_announcements ();
}
@@ -657,7 +659,7 @@ ARDOUR_UI::load_from_application_api (const std::string& path)
line arguments to an app via the openFile delegate protocol. Ardour
already does its own command line processing, and having both
pathways active causes crashes. So, if the command line was already
- set, do nothing here.
+ set, do nothing here. NSM also uses this code path.
*/
if (!ARDOUR_COMMAND_LINE::session_name.empty()) {
@@ -675,10 +677,23 @@ ARDOUR_UI::load_from_application_api (const std::string& path)
*/
if (startup_fsm) {
+ /* this will result in the StartupFSM signalling us to load a
+ * session, which if successful will then destroy the
+ * startupFSM and we'll move right along.
+ */
+
startup_fsm->handle_path (path);
return;
}
+ /* the mechanisms that can result is this being called are only
+ * possible for existing sessions.
+ */
+
+ if (!Glib::file_test (path, Glib::FILE_TEST_EXISTS)) {
+ return;
+ }
+
ARDOUR_COMMAND_LINE::session_name = path;
int rv;
@@ -691,7 +706,7 @@ ARDOUR_UI::load_from_application_api (const std::string& path)
rv = load_session (Glib::path_get_dirname (path), basename_nosuffix (path));
}
- // if load_session fails, and there is no existing session ....
+ // there was no startupFSM, load_session fails, and there is no existing session ....
if (rv && !_session) {
diff --git a/gtk2_ardour/startup_fsm.cc b/gtk2_ardour/startup_fsm.cc
index d7a41c102a..5a22c79ed9 100644
--- a/gtk2_ardour/startup_fsm.cc
+++ b/gtk2_ardour/startup_fsm.cc
@@ -95,7 +95,6 @@ StartupFSM::StartupFSM (EngineControl& amd)
Application* app = Application::instance ();
app->ShouldQuit.connect (sigc::mem_fun (*this, &StartupFSM::queue_finish));
- app->ShouldLoad.connect (sigc::mem_fun (*this, &StartupFSM::load_from_application_api));
Gtkmm2ext::Keyboard::HideMightMeanQuit.connect (sigc::mem_fun (*this, &StartupFSM::dialog_hidden));
}
@@ -567,6 +566,7 @@ StartupFSM::get_session_parameters_from_path (string const & path, string const
session_path = path;
}
+ session_template = string ();
if (!template_name.empty()) {
@@ -829,22 +829,6 @@ StartupFSM::copy_demo_sessions ()
}
}
-void
-StartupFSM::load_from_application_api (const std::string& path)
-{
- if (!ARDOUR_COMMAND_LINE::session_name.empty()) {
- return;
- }
-
- /* just set this as if it was given on the command line, rather than
- * supplied via some desktop system (e.g. macOS application delegate
- * and "openFile". Note that this relies on this being invoked before
- * StartupFSM::start().
- */
-
- ARDOUR_COMMAND_LINE::session_name = path;
-}
-
bool
StartupFSM::ask_about_loading_existing_session (const std::string& session_path)
{
diff --git a/gtk2_ardour/startup_fsm.h b/gtk2_ardour/startup_fsm.h
index dd3d975611..0c3f9e814a 100644
--- a/gtk2_ardour/startup_fsm.h
+++ b/gtk2_ardour/startup_fsm.h
@@ -75,7 +75,6 @@ class StartupFSM : public sigc::trackable
sigc::signal1<void,Result>& signal_response() { return _signal_response; }
bool brand_new_user() const { return new_user; }
-
void handle_path (std::string const & path);
private:
@@ -96,7 +95,6 @@ class StartupFSM : public sigc::trackable
void show_plugin_scan_dialog ();
void copy_demo_sessions ();
- void load_from_application_api (std::string const &);
bool get_session_parameters_from_command_line (bool new_session_required);
bool get_session_parameters_from_path (std::string const & path, std::string const & template_name, bool new_session_required);
void queue_finish ();