basic pass at deleting scratch sessions
This commit is contained in:
parent
4d9017a1fb
commit
900bab7271
@ -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 ()
|
||||
{
|
||||
|
@ -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__ */
|
||||
|
@ -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 ();
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user