summaryrefslogtreecommitdiff
path: root/gtk2_ardour/ardour_ui.cc
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2015-10-12 12:29:16 +0200
committerPaul Davis <paul@linuxaudiosystems.com>2015-10-21 23:28:44 -0400
commit5d50abed75de5428c025e61224068387ab15e26d (patch)
treec1894e776615765c95ef2790f3a8f740a8e4fbda /gtk2_ardour/ardour_ui.cc
parent67f557b1f4fd1f1ecd9d38f14d83a12a294cb455 (diff)
Confirmation on overwrite for track and session templates. -fixes #6587
Diffstat (limited to 'gtk2_ardour/ardour_ui.cc')
-rw-r--r--gtk2_ardour/ardour_ui.cc23
1 files changed, 12 insertions, 11 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index e29c1bbf8d..4e016d266a 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -2495,16 +2495,8 @@ ARDOUR_UI::snapshot_session (bool switch_to_it)
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;
- }
+ do_save = overwrite_file_dialog (_("Confirm Snapshot Overwrite"),
+ _("A snapshot already exists with that name. Do you want to overwrite it?"));
}
if (do_save) {
@@ -2690,7 +2682,16 @@ ARDOUR_UI::save_template ()
prompter.get_result (name);
if (name.length()) {
- _session->save_template (name);
+ int failed = _session->save_template (name);
+
+ if (failed == -2) { /* file already exists. */
+ bool overwrite = overwrite_file_dialog (_("Confirm Template Overwrite"),
+ _("A template already exists with that name. Do you want to overwrite it?"));
+
+ if (overwrite) {
+ _session->save_template (name, true);
+ }
+ }
}
break;