summaryrefslogtreecommitdiff
path: root/libs/ardour/plugin.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-01-09 00:51:24 +0100
committerRobin Gareus <robin@gareus.org>2016-01-09 00:51:24 +0100
commitce7d18bc16352e57a6c150ba65d1267c3c6ab3c3 (patch)
treeb9623e86946627b9b3de812a1a52c0458ffe7437 /libs/ardour/plugin.cc
parent3718b4109be74f5eb13e8313b75b84ab1cc436d3 (diff)
don't allow to delete factory presets
Diffstat (limited to 'libs/ardour/plugin.cc')
-rw-r--r--libs/ardour/plugin.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/libs/ardour/plugin.cc b/libs/ardour/plugin.cc
index d6c9a48805..047e151710 100644
--- a/libs/ardour/plugin.cc
+++ b/libs/ardour/plugin.cc
@@ -120,6 +120,12 @@ Plugin::~Plugin ()
void
Plugin::remove_preset (string name)
{
+ Plugin::PresetRecord const * p = preset_by_label (name);
+ if (!p->user) {
+ PBD::error << _("Cannot remove plugin factory preset.") << PBD::endmsg;
+ return;
+ }
+
do_remove_preset (name);
_presets.erase (preset_by_label (name)->uri);
@@ -133,6 +139,11 @@ Plugin::remove_preset (string name)
Plugin::PresetRecord
Plugin::save_preset (string name)
{
+ if (preset_by_label (name)) {
+ PBD::error << _("Preset with given name already exists.") << PBD::endmsg;
+ return Plugin::PresetRecord ();
+ }
+
string const uri = do_save_preset (name);
if (!uri.empty()) {