Do not allow to delete the last snapshot

In case a user manually renames a session-folder and snapshot
it should still be impossible to delete the last snapshot
even if it is not named after the session-dir.

In theory this is impossible (one cannot delete the current snapshot)
This commit is contained in:
Robin Gareus 2022-08-10 03:14:08 +02:00
parent 6dc1e1f778
commit b5d96f0de2
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
1 changed files with 1 additions and 2 deletions

View File

@ -145,10 +145,9 @@ EditorSnapshots::popup_context_menu (int button, int32_t time, std::string snaps
MenuList& items (_menu.items());
items.clear ();
const bool modification_allowed = (_session->snap_name() != snapshot_name && _session->name() != snapshot_name);
const bool modification_allowed = (_session->snap_name() != snapshot_name && _session->name() != snapshot_name && _snapshot_model->children().size () > 1);
add_item_with_sensitivity (items, MenuElem (_("Remove"), sigc::bind (sigc::mem_fun (*this, &EditorSnapshots::remove), snapshot_name)), modification_allowed);
add_item_with_sensitivity (items, MenuElem (_("Rename..."), sigc::bind (sigc::mem_fun (*this, &EditorSnapshots::rename), snapshot_name)), modification_allowed);
_menu.popup (button, time);