13
0

Prefer testing the session instead of using a global variable

This commit is contained in:
Robin Gareus 2018-12-06 02:23:53 +01:00
parent bf874562ef
commit 4dc65e6613
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
5 changed files with 4 additions and 14 deletions

View File

@ -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;

View File

@ -195,7 +195,6 @@ 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; }

View File

@ -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 ();

View File

@ -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;
}

View File

@ -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);