diff options
author | Robin Gareus <robin@gareus.org> | 2017-07-26 23:34:21 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-07-26 23:49:57 +0200 |
commit | 53565962b2a0b4bc0ac34608d897d9f7885d369a (patch) | |
tree | 938cfd21242dfcdbfa23883c5a953942b66d8921 | |
parent | 28c29ab22dfb13ca185175ed94ba2d27c72489cf (diff) |
Ask user to save when using save-as or snapshot+switch.
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 00e3129dc0..d6389d68b4 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -2766,6 +2766,33 @@ ARDOUR_UI::save_session_as () return; } + if (_session->dirty()) { + vector<string> actions; + actions.push_back (_("Abort save-as")); + actions.push_back (_("Don't save now, just save-as")); + actions.push_back (_("Save it first")); + switch (ask_about_saving_session(actions)) { + case -1: + return; + break; + case 1: + if (save_state_canfail ("")) { + MessageDialog msg (_main_window, + string_compose (_("\ +%1 was unable to save your session.\n\n\ +If you still wish to proceeed, please use the\n\n\ +\"Don't save now\" option."), PROGRAM_NAME)); + pop_back_splash(msg); + msg.run (); + return; + } + // no break + case 0: + _session->remove_pending_capture_state (); + break; + } + } + if (!save_as_dialog) { save_as_dialog = new SaveAsDialog; } @@ -2880,6 +2907,9 @@ ARDOUR_UI::quick_snapshot_session (bool switch_to_it) time (&n); localtime_r (&n, &local_time); strftime (timebuf, sizeof(timebuf), "%FT%H.%M.%S", &local_time); + if (switch_to_it && _session->dirty ()) { + save_state_canfail (""); + } save_state (timebuf, switch_to_it); } @@ -2932,8 +2962,34 @@ ARDOUR_UI::process_snapshot_session_prompter (Prompter& prompter, bool switch_to void ARDOUR_UI::snapshot_session (bool switch_to_it) { - Prompter prompter (true); + if (switch_to_it && _session->dirty()) { + vector<string> actions; + actions.push_back (_("Abort saving snapshot")); + actions.push_back (_("Don't save now, just snapshot")); + actions.push_back (_("Save it first")); + switch (ask_about_saving_session(actions)) { + case -1: + return; + break; + case 1: + if (save_state_canfail ("")) { + MessageDialog msg (_main_window, + string_compose (_("\ +%1 was unable to save your session.\n\n\ +If you still wish to proceeed, please use the\n\n\ +\"Don't save now\" option."), PROGRAM_NAME)); + pop_back_splash(msg); + msg.run (); + return; + } + // no break + case 0: + _session->remove_pending_capture_state (); + break; + } + } + Prompter prompter (true); prompter.set_name ("Prompter"); prompter.add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT); if (switch_to_it) { |