From 2cea8620b5eda7cb0aca53cbdd219b68e49fb242 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 7 May 2009 12:24:03 +0000 Subject: [PATCH] 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 --- gtk2_ardour/ardour_ui.cc | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 49ad2288b8..e88a469b92 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -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 p; + get_state_files_in_directory (session->session_directory().root_path(), p); + vector 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;