diff options
author | André Nusser <andre.nusser@googlemail.com> | 2015-10-12 13:01:05 +0200 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-10-21 23:28:44 -0400 |
commit | 2c4e79d0a087ab1aafb5aa53ce0e88c3b74220bc (patch) | |
tree | f046ede6e4482e8f5c090b0a767dc35978ce70e7 /gtk2_ardour | |
parent | 5d50abed75de5428c025e61224068387ab15e26d (diff) |
Also use overwrite_file_dialog at all the other places.
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/editor_export_audio.cc | 34 | ||||
-rw-r--r-- | gtk2_ardour/utils_videotl.cc | 14 |
2 files changed, 16 insertions, 32 deletions
diff --git a/gtk2_ardour/editor_export_audio.cc b/gtk2_ardour/editor_export_audio.cc index 57baf2ce2d..c886885dd2 100644 --- a/gtk2_ardour/editor_export_audio.cc +++ b/gtk2_ardour/editor_export_audio.cc @@ -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); diff --git a/gtk2_ardour/utils_videotl.cc b/gtk2_ardour/utils_videotl.cc index 51cbe1a1dd..0c94f378f0 100644 --- a/gtk2_ardour/utils_videotl.cc +++ b/gtk2_ardour/utils_videotl.cc @@ -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); |