Permalink
Browse files

Prefer testing the session instead of using a global variable

  • Loading branch information...
x42 committed Dec 6, 2018
1 parent bf87456 commit 4dc65e6613a375a836de4dd9901ac50a4ab43be6
@@ -272,7 +272,6 @@ libxml_structured_error_func (void* /* parsing_context*/,
ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
: Gtkmm2ext::UI (PROGRAM_NAME, X_("gui"), argcp, argvp)
, session_loaded (false)
, session_load_in_progress (false)
, gui_object_state (new GUIObjectState)
, primary_clock (new MainClock (X_("primary"), X_("transport"), true ))
@@ -3547,8 +3546,6 @@ ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name,
}
}
session_loaded = false;
loading_message (string_compose (_("Please wait while %1 loads your session"), PROGRAM_NAME));
try {
@@ -3658,8 +3655,6 @@ ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name,
set_session (new_session);
session_loaded = true;
if (_session) {
_session->set_clean ();
}
@@ -3703,7 +3698,6 @@ ARDOUR_UI::build_session (const std::string& path, const std::string& snap_name,
Session *new_session;
int x;
session_loaded = false;
x = unload_session ();
if (x < 0) {
@@ -3768,8 +3762,6 @@ ARDOUR_UI::build_session (const std::string& path, const std::string& snap_name,
set_session (new_session);
session_loaded = true;
new_session->save_state(new_session->name());
return 0;
@@ -195,7 +195,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr, public
void finish();
int load_session (const std::string& path, const std::string& snapshot, std::string mix_template = std::string());
bool session_loaded;
bool session_load_in_progress;
int build_session (const std::string& path, const std::string& snapshot, ARDOUR::BusProfile*);
bool session_is_new() const { return _session_is_new; }
@@ -337,10 +337,9 @@ ARDOUR_UI::unload_session (bool hide_stuff)
blink_connection.disconnect ();
delete _session;
ARDOUR::Session* session_to_delete = _session;
_session = 0;
session_loaded = false;
delete session_to_delete;
update_title ();
@@ -983,7 +983,7 @@ Editor::set_entered_track (TimeAxisView* tav)
void
Editor::instant_save ()
{
if (!constructed || !ARDOUR_UI::instance()->session_loaded || no_save_instant) {
if (!constructed || no_save_instant) {
return;
}
@@ -666,7 +666,7 @@ SessionDialog::setup_new_session_page ()
//determine the text in the new folder selector
if (!ARDOUR_COMMAND_LINE::session_name.empty()) {
new_folder_chooser.set_current_folder (poor_mans_glob (Glib::path_get_dirname (ARDOUR_COMMAND_LINE::session_name)));
} else if (ARDOUR_UI::instance()->session_loaded) {
} else if (ARDOUR_UI::instance()->the_session ()) {
// point the new session file chooser at the parent directory of the current session
string session_parent_dir = Glib::path_get_dirname(ARDOUR_UI::instance()->the_session()->path());
new_folder_chooser.set_current_folder (session_parent_dir);

0 comments on commit 4dc65e6

Please sign in to comment.