mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 07:14:56 +01:00
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
3 changed files with 9 additions and 20 deletions
|
|
@ -2033,20 +2033,13 @@ int
|
||||||
ARDOUR_UI::load_session (const string & path, const string & snap_name, string* mix_template)
|
ARDOUR_UI::load_session (const string & path, const string & snap_name, string* mix_template)
|
||||||
{
|
{
|
||||||
Session *new_session;
|
Session *new_session;
|
||||||
int x;
|
|
||||||
session_loaded = false;
|
session_loaded = false;
|
||||||
|
|
||||||
if (!check_audioengine()) {
|
if (!check_audioengine()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
x = unload_session ();
|
if(!unload_session ()) return -1;
|
||||||
|
|
||||||
if (x < 0) {
|
|
||||||
return -1;
|
|
||||||
} else if (x > 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if it already exists, we must have write access */
|
/* 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)
|
nframes_t initial_length)
|
||||||
{
|
{
|
||||||
Session *new_session;
|
Session *new_session;
|
||||||
int x;
|
|
||||||
|
|
||||||
if (!check_audioengine()) {
|
if (!check_audioengine()) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -2102,13 +2094,7 @@ ARDOUR_UI::build_session (const string & path, const string & snap_name,
|
||||||
|
|
||||||
session_loaded = false;
|
session_loaded = false;
|
||||||
|
|
||||||
x = unload_session ();
|
if (!unload_session ()) return -1;
|
||||||
|
|
||||||
if (x < 0) {
|
|
||||||
return -1;
|
|
||||||
} else if (x > 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
_session_is_new = true;
|
_session_is_new = true;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI
|
||||||
|
|
||||||
bool new_session(std::string path = string());
|
bool new_session(std::string path = string());
|
||||||
gint cmdline_new_session (string path);
|
gint cmdline_new_session (string path);
|
||||||
int unload_session ();
|
|
||||||
|
/// @return true if session was successfully unloaded.
|
||||||
|
bool unload_session ();
|
||||||
void close_session();
|
void close_session();
|
||||||
|
|
||||||
int save_state_canfail (string state_name = "");
|
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);
|
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 ()
|
ARDOUR_UI::unload_session ()
|
||||||
{
|
{
|
||||||
if (session && session->dirty()) {
|
if (session && session->dirty()) {
|
||||||
switch (ask_about_saving_session (_("close"))) {
|
switch (ask_about_saving_session (_("close"))) {
|
||||||
case -1:
|
case -1:
|
||||||
return 1;
|
// cancel
|
||||||
|
return false;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
session->save_state ("");
|
session->save_state ("");
|
||||||
|
|
@ -212,7 +213,7 @@ ARDOUR_UI::unload_session ()
|
||||||
|
|
||||||
update_buffer_load ();
|
update_buffer_load ();
|
||||||
|
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue