diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-05-23 21:12:07 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-05-23 21:12:07 +0000 |
commit | 32be58740d31405225b33d4314a69f599ea349b9 (patch) | |
tree | 6dbb993f2344e27fdeb1e52d09277560b4a3592a /gtk2_ardour/editor_export_audio.cc | |
parent | e0d0735fa2c2543c6995e9128dbd16c799f4ec8f (diff) |
minor polish for midi export dialog
git-svn-id: svn://localhost/ardour2/branches/3.0@12403 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_export_audio.cc')
-rw-r--r-- | gtk2_ardour/editor_export_audio.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/gtk2_ardour/editor_export_audio.cc b/gtk2_ardour/editor_export_audio.cc index 9521f6a0c6..dbe95c229f 100644 --- a/gtk2_ardour/editor_export_audio.cc +++ b/gtk2_ardour/editor_export_audio.cc @@ -136,7 +136,42 @@ Editor::export_region () return; } + dialog.hide (); + string path = dialog.get_path (); + + if (Glib::file_test (path, Glib::FILE_TEST_EXISTS)) { + + 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 unlink because the backend code will + go wrong if it tries to open an existing + file for writing. + */ + ::unlink (path.c_str()); + break; + default: + return; + } + + } + (void) midi_region->clone (path); } } |