13
0

basic pass at deleting scratch sessions

This commit is contained in:
Paul Davis 2020-03-24 20:58:38 -06:00
parent 4d9017a1fb
commit 900bab7271
4 changed files with 42 additions and 29 deletions

View File

@ -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 ();
@ -1093,6 +1066,40 @@ If you still wish to quit, please use the\n\n\
quit ();
}
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 ()
{

View File

@ -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__ */

View File

@ -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 ();

View File

@ -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;
}