Also use overwrite_file_dialog at all the other places.

This commit is contained in:
André Nusser 2015-10-12 13:01:05 +02:00 committed by Paul Davis
parent 5d50abed75
commit 2c4e79d0a0
2 changed files with 16 additions and 32 deletions

View File

@ -51,6 +51,7 @@
#include "public_editor.h"
#include "selection.h"
#include "time_axis_view.h"
#include "utils.h"
#include "i18n.h"
@ -141,35 +142,18 @@ Editor::export_region ()
string path = dialog.get_path ();
if (Glib::file_test (path, Glib::FILE_TEST_EXISTS)) {
bool overwrite = ARDOUR_UI_UTILS::overwrite_file_dialog (_("Confirm MIDI File Overwrite"),
_("A file with the same name already exists. Do you want to overwrite it?"));
MessageDialog checker (_("File Exists!"),
true,
Gtk::MESSAGE_WARNING,
Gtk::BUTTONS_NONE);
checker.set_title (_("File Exists!"));
checker.add_button (Stock::CANCEL, RESPONSE_CANCEL);
checker.add_button (_("Overwrite Existing File"), RESPONSE_ACCEPT);
checker.set_default_response (RESPONSE_CANCEL);
checker.set_wmclass (X_("midi_export_file_exists"), PROGRAM_NAME);
checker.set_position (Gtk::WIN_POS_MOUSE);
ret = checker.run ();
switch (ret) {
case Gtk::RESPONSE_ACCEPT:
/* force ::g_unlink because the backend code will
go wrong if it tries to open an existing
file for writing.
*/
::g_unlink (path.c_str());
break;
default:
if (!overwrite) {
return;
}
/* force ::g_unlink because the backend code will
go wrong if it tries to open an existing
file for writing.
*/
::g_unlink (path.c_str());
}
(void) midi_region->clone (path);

View File

@ -28,6 +28,7 @@
#include "ardour/session_directory.h"
#include "video_image_frame.h"
#include "utils_videotl.h"
#include "utils.h"
#ifdef WAF_BUILD
#include "gtk2ardour-version.h"
@ -67,13 +68,12 @@ VideoUtils::confirm_video_outfn (std::string outfn, std::string docroot)
}
if (Glib::file_test(outfn, Glib::FILE_TEST_EXISTS)) {
ArdourDialog confirm (_("Confirm Overwrite"), true);
Label m (_("A file with the same name already exists. 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 ();
if (confirm.run() == RESPONSE_CANCEL) { return false; }
bool overwrite = ARDOUR_UI_UTILS::overwrite_file_dialog (_("Confirm Overwrite"),
_("A file with the same name already exists. Do you want to overwrite it?"));
if (!overwrite) {
return false;
}
}
std::string dir = Glib::path_get_dirname (outfn);