Use bool return type for ARDOUR_UI::unload_session to indicate success/failure.
git-svn-id: svn://localhost/ardour2/trunk@1860 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
dbb8f65d8d
commit
00fc7b1fa2
|
@ -2033,20 +2033,13 @@ int
|
|||
ARDOUR_UI::load_session (const string & path, const string & snap_name, string* mix_template)
|
||||
{
|
||||
Session *new_session;
|
||||
int x;
|
||||
session_loaded = false;
|
||||
|
||||
if (!check_audioengine()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
x = unload_session ();
|
||||
|
||||
if (x < 0) {
|
||||
return -1;
|
||||
} else if (x > 0) {
|
||||
return 0;
|
||||
}
|
||||
if(!unload_session ()) return -1;
|
||||
|
||||
/* if it already exists, we must have write access */
|
||||
|
||||
|
@ -2094,7 +2087,6 @@ ARDOUR_UI::build_session (const string & path, const string & snap_name,
|
|||
nframes_t initial_length)
|
||||
{
|
||||
Session *new_session;
|
||||
int x;
|
||||
|
||||
if (!check_audioengine()) {
|
||||
return -1;
|
||||
|
@ -2102,13 +2094,7 @@ ARDOUR_UI::build_session (const string & path, const string & snap_name,
|
|||
|
||||
session_loaded = false;
|
||||
|
||||
x = unload_session ();
|
||||
|
||||
if (x < 0) {
|
||||
return -1;
|
||||
} else if (x > 0) {
|
||||
return 0;
|
||||
}
|
||||
if (!unload_session ()) return -1;
|
||||
|
||||
_session_is_new = true;
|
||||
|
||||
|
|
|
@ -129,7 +129,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI
|
|||
|
||||
bool new_session(std::string path = string());
|
||||
gint cmdline_new_session (string path);
|
||||
int unload_session ();
|
||||
|
||||
/// @return true if session was successfully unloaded.
|
||||
bool unload_session ();
|
||||
void close_session();
|
||||
|
||||
int save_state_canfail (string state_name = "");
|
||||
|
|
|
@ -162,13 +162,14 @@ ARDOUR_UI::connect_to_session (Session *s)
|
|||
point_zero_one_second_connection = Glib::signal_timeout().connect (mem_fun(*this, &ARDOUR_UI::every_point_zero_one_seconds), 40);
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
ARDOUR_UI::unload_session ()
|
||||
{
|
||||
if (session && session->dirty()) {
|
||||
switch (ask_about_saving_session (_("close"))) {
|
||||
case -1:
|
||||
return 1;
|
||||
// cancel
|
||||
return false;
|
||||
|
||||
case 1:
|
||||
session->save_state ("");
|
||||
|
@ -212,7 +213,7 @@ ARDOUR_UI::unload_session ()
|
|||
|
||||
update_buffer_load ();
|
||||
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Reference in New Issue
Block a user