Ask user to confirm overwrite of a snapshot, to fix mantis 2656.

git-svn-id: svn://localhost/ardour2/branches/3.0@5057 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-05-07 12:24:03 +00:00
parent a63ae4be80
commit 2cea8620b5

View file

@ -1898,11 +1898,34 @@ ARDOUR_UI::snapshot_session ()
switch (prompter.run()) {
case RESPONSE_ACCEPT:
{
prompter.get_result (snapname);
if (snapname.length()){
bool do_save = (snapname.length() != 0);
vector<sys::path> p;
get_state_files_in_directory (session->session_directory().root_path(), p);
vector<string> n = get_file_names_no_extension (p);
if (find (n.begin(), n.end(), snapname) != n.end()) {
ArdourDialog confirm (_("Confirm snapshot overwrite"), true);
Label m (_("A snapshot already exists with that name. Do you want to overwrite it?"));
confirm.get_vbox()->pack_start (m, true, true);
confirm.add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
confirm.add_button (_("Overwrite"), Gtk::RESPONSE_ACCEPT);
confirm.show_all ();
switch (confirm.run()) {
case RESPONSE_CANCEL:
do_save = false;
}
}
if (do_save) {
std::cout << "DOING IT!" << std::endl;
save_state (snapname);
}
break;
}
default:
break;