summaryrefslogtreecommitdiff
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
parent4d9017a1fb3d51a8f96f3655e6ed6892c2913c2f (diff)
basic pass at deleting scratch sessions
-rw-r--r--gtk2_ardour/ardour_ui.cc63
-rw-r--r--gtk2_ardour/ardour_ui.h2
-rw-r--r--gtk2_ardour/ardour_ui_dialogs.cc5
-rw-r--r--gtk2_ardour/audio_clock.cc1
4 files changed, 42 insertions, 29 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 ();
diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h
index e0e212feb0..19e7fc55dc 100644
--- a/gtk2_ardour/ardour_ui.h
+++ b/gtk2_ardour/ardour_ui.h
@@ -890,6 +890,8 @@ private:
bool bind_lua_action_script (GdkEventButton*, int);
void update_action_script_btn (int i, const std::string&);
+
+ void ask_about_scratch_deletion ();
};
#endif /* __ardour_gui_h__ */
diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc
index e826f9500a..51ffd894af 100644
--- a/gtk2_ardour/ardour_ui_dialogs.cc
+++ b/gtk2_ardour/ardour_ui_dialogs.cc
@@ -308,13 +308,16 @@ ARDOUR_UI::unload_session (bool hide_stuff)
case -1:
// cancel
return 1;
-
case 1:
+ if (_session->unnamed()) {
+ rename_session (true);
+ }
_session->save_state ("");
break;
}
}
+
{
// tear down session specific CPI (owned by rc_config_editor which can remain)
ControlProtocolManager& m = ControlProtocolManager::instance ();
diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc
index 1dd8c7b86e..3908682686 100644
--- a/gtk2_ardour/audio_clock.cc
+++ b/gtk2_ardour/audio_clock.cc
@@ -916,6 +916,7 @@ AudioClock::set (samplepos_t when, bool force, samplecnt_t offset)
break;
case Samples:
+ std::cerr << this << " set (" << when << ")\n";
set_samples (when, force);
break;
}