return S_ISREG (statbuf.st_mode);
}
+bool
+ARDOUR_UI::check_audioengine ()
+{
+ if (engine) {
+ if (!engine->connected()) {
+ MessageDialog msg (_("Ardour is not connected to JACK\n"
+ "You cannot open or close sessions in this condition"));
+ msg.run ();
+ return false;
+ }
+ return true;
+ } else {
+ return false;
+ }
+}
+
void
ARDOUR_UI::open_session ()
{
+ if (!check_audioengine()) {
+ return;
+
+ }
+
/* popup selector window */
if (open_session_selector == 0) {
string session_name;
string session_path;
- if (!engine->connected()) {
- MessageDialog msg (_("Ardour is not connected to JACK at this time. Creating new sessions is not possible."));
- msg.run ();
+ if (!check_audioengine()) {
return false;
}
new_session_dialog->set_name (predetermined_path);
new_session_dialog->reset_recent();
new_session_dialog->show();
+ new_session_dialog->set_current_page (0);
do {
response = new_session_dialog->run ();
- if (!engine->connected()) {
+ if (!check_audioengine()) {
new_session_dialog->hide ();
- MessageDialog msg (_("Ardour is not connected to JACK at this time. Creating new sessions is not possible."));
- msg.run ();
return false;
}
void
ARDOUR_UI::close_session()
{
+ if (!check_audioengine()) {
+ return;
+ }
+
unload_session();
new_session ();
}
int x;
session_loaded = false;
+ if (!check_audioengine()) {
+ return -1;
+ }
+
x = unload_session ();
if (x < 0) {
Session *new_session;
int x;
+ if (!check_audioengine()) {
+ return -1;
+ }
+
session_loaded = false;
+
x = unload_session ();
+
if (x < 0) {
return -1;
} else if (x > 0) {