summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-10-08 12:18:27 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-10-08 12:18:27 -0400
commit19ba3b8de787637b29dda0b9f71a1eaf8987ad93 (patch)
tree552128572f53d45d9094b14516a32dd86358112b
parent22eea8e9e29e91319163f63b6bdefbcbd1062714 (diff)
fix some issues with window flow when session loading fails; shrink "New Session" button in session setup dialog
-rw-r--r--gtk2_ardour/ardour_ui.cc20
-rw-r--r--gtk2_ardour/session_dialog.cc34
-rw-r--r--gtk2_ardour/session_dialog.h4
3 files changed, 42 insertions, 16 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index 5cc72293fb..d09544fcf4 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -2596,11 +2596,14 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
} else {
session_path = "";
session_name = "";
+ session_dialog.clear_given ();
}
-
+
if (should_be_new || session_name.empty()) {
/* need the dialog to get info from user */
-
+
+ cerr << "run dialog\n";
+
switch (session_dialog.run()) {
case RESPONSE_ACCEPT:
break;
@@ -2643,8 +2646,6 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
_session_is_new = true;
}
- cerr << "SN " << session_name << " SP " << session_path << endl;
-
if (session_name[0] == G_DIR_SEPARATOR ||
(session_name.length() > 2 && session_name[0] == '.' && session_name[1] == G_DIR_SEPARATOR) ||
(session_name.length() > 3 && session_name[0] == '.' && session_name[1] == '.' && session_name[2] == G_DIR_SEPARATOR)) {
@@ -2699,10 +2700,11 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
}
char illegal = Session::session_name_is_legal(session_name);
+
if (illegal) {
pop_back_splash (session_dialog);
MessageDialog msg (session_dialog, string_compose(_("To ensure compatibility with various systems\n"
- "session names may not contain a '%1' character"), illegal));
+ "session names may not contain a '%1' character"), illegal));
msg.run ();
ARDOUR_COMMAND_LINE::session_name = ""; // cancel that
continue;
@@ -2717,8 +2719,6 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
} else {
- cerr << "Loading session with path = " << session_path << " name = " << session_name << " template " << template_name << endl;
-
ret = load_session (session_path, session_name, template_name);
if (ret == -2) {
@@ -2730,6 +2730,12 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
_session->save_state (ARDOUR_COMMAND_LINE::immediate_save, false);
exit (1);
}
+
+ /* clear this to avoid endless attempts to load the
+ same session.
+ */
+
+ ARDOUR_COMMAND_LINE::session_name = "";
}
}
diff --git a/gtk2_ardour/session_dialog.cc b/gtk2_ardour/session_dialog.cc
index 1eacf00d0d..996dab1cc4 100644
--- a/gtk2_ardour/session_dialog.cc
+++ b/gtk2_ardour/session_dialog.cc
@@ -74,11 +74,6 @@ SessionDialog::SessionDialog (bool require_new, const std::string& session_name,
, _master_bus_channel_count_adj (2, 0, 100, 1, 10, 0)
, _existing_session_chooser_used (false)
{
- if (!session_name.empty() && !require_new) {
- response (RESPONSE_OK);
- return;
- }
-
set_keep_above (true);
set_position (WIN_POS_CENTER);
get_vbox()->set_spacing (6);
@@ -143,12 +138,32 @@ SessionDialog::SessionDialog (bool require_new, const std::string& session_name,
recent_label.hide ();
}
}
+
+ /* possibly get out of here immediately if everything is ready to go.
+ We still need to set up the whole dialog because of the way
+ ARDOUR_UI::get_session_parameters() might skip it on a first
+ pass then require it for a second pass (e.g. when there
+ is an error with session loading and we have to ask the user
+ what to do next).
+ */
+
+ if (!session_name.empty() && !require_new) {
+ response (RESPONSE_OK);
+ return;
+ }
}
SessionDialog::~SessionDialog()
{
}
+void
+SessionDialog::clear_given ()
+{
+ _provided_session_path = "";
+ _provided_session_name = "";
+}
+
bool
SessionDialog::use_session_template ()
{
@@ -256,7 +271,9 @@ SessionDialog::setup_initial_choice_box ()
ic_new_session_button.signal_clicked().connect (sigc::mem_fun (*this, &SessionDialog::new_session_button_clicked));
Gtk::HBox* hbox = manage (new HBox);
+ Gtk::VBox* vbox = manage (new VBox);
hbox->set_spacing (12);
+ vbox->set_spacing (12);
string image_path;
@@ -266,9 +283,10 @@ SessionDialog::setup_initial_choice_box ()
hbox->pack_start (*image, false, false);
}
}
-
- hbox->pack_start (ic_new_session_button, true, true);
-
+
+ vbox->pack_start (ic_new_session_button, true, true, 20);
+ hbox->pack_start (*vbox, true, true, 20);
+
centering_vbox->pack_start (*hbox, false, false);
/* Possible update message */
diff --git a/gtk2_ardour/session_dialog.h b/gtk2_ardour/session_dialog.h
index 782466a834..2178cfbe73 100644
--- a/gtk2_ardour/session_dialog.h
+++ b/gtk2_ardour/session_dialog.h
@@ -51,9 +51,11 @@ class SessionDialog : public ArdourDialog {
const std::string& template_name, bool cancel_not_quit);
~SessionDialog ();
+ void clear_given ();
+
std::string session_name (bool& should_be_new);
std::string session_folder ();
-
+
bool use_session_template();
std::string session_template_name();