summaryrefslogtreecommitdiff
path: root/gtk2_ardour/ardour_ui.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2020-03-24 20:58:38 -0600
committerPaul Davis <paul@linuxaudiosystems.com>2020-03-24 21:15:32 -0600
commit900bab7271f833139ef37e88e9f739c867cef423 (patch)
tree0efbdaaf662abbe1b06725ecb31eab6b72bd5f29 /gtk2_ardour/ardour_ui.cc
parent4d9017a1fb3d51a8f96f3655e6ed6892c2913c2f (diff)
basic pass at deleting scratch sessions
Diffstat (limited to 'gtk2_ardour/ardour_ui.cc')
-rw-r--r--gtk2_ardour/ardour_ui.cc63
1 files changed, 35 insertions, 28 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index f1bcf52f89..04985c85b5 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -1047,36 +1047,9 @@ If you still wish to quit, please use the\n\n\
if (_session) {
- string path;
-
if (delete_unnamed_session) {
-
- path = _session->path();
-
- ArdourMessageDialog msg (_main_window,
- _("DANGER!"),
- true,
- Gtk::MESSAGE_WARNING,
- Gtk::BUTTONS_NONE, true);
-
- msg.set_secondary_text (string_compose (_("You have not named this session yet.\n"
- "You can continue to use it as\n\n"
- "%1\n\n"
- "or it will be deleted.\n\n"
- "Deletion is permanent and irreversible."), _session->name()));
-
- msg.set_title (_("SCRATCH SESSION - DANGER!"));
- msg.add_button (_("Delete this session (IRREVERSIBLE!)"), RESPONSE_OK);
- msg.add_button (_("Do not delete"), RESPONSE_CANCEL);
- msg.set_default_response (RESPONSE_CANCEL);
- msg.set_position (Gtk::WIN_POS_MOUSE);
-
- int r = msg.run ();
-
- if (r == Gtk::RESPONSE_OK) {
- PBD::remove_directory (path);
- }
+ ask_about_scratch_deletion ();
}
_session->set_clean ();
@@ -1094,6 +1067,40 @@ If you still wish to quit, please use the\n\n\
}
void
+ARDOUR_UI::ask_about_scratch_deletion ()
+{
+ if (!_session) {
+ return;
+ }
+
+ string path = _session->path();
+
+ ArdourMessageDialog msg (_main_window,
+ _("DANGER!"),
+ true,
+ Gtk::MESSAGE_WARNING,
+ Gtk::BUTTONS_NONE, true);
+
+ msg.set_secondary_text (string_compose (_("You have not named this session yet.\n"
+ "You can continue to use it as\n\n"
+ "%1\n\n"
+ "or it will be deleted.\n\n"
+ "Deletion is permanent and irreversible."), _session->name()));
+
+ msg.set_title (_("SCRATCH SESSION - DANGER!"));
+ msg.add_button (_("Delete this session (IRREVERSIBLE!)"), RESPONSE_OK);
+ msg.add_button (_("Do not delete"), RESPONSE_CANCEL);
+ msg.set_default_response (RESPONSE_CANCEL);
+ msg.set_position (Gtk::WIN_POS_MOUSE);
+
+ int r = msg.run ();
+
+ if (r == Gtk::RESPONSE_OK) {
+ PBD::remove_directory (path);
+ }
+}
+
+void
ARDOUR_UI::every_second ()
{
update_cpu_load ();