summaryrefslogtreecommitdiff
path: root/libs/ardour/session_state.cc
diff options
context:
space:
mode:
authorJohannes Mueller <github@johannes-mueller.org>2017-08-18 19:53:46 +0200
committerRobin Gareus <robin@gareus.org>2017-08-20 21:09:30 +0200
commitae51d5fd4ebb90f782334ac0b4addc0c88e1629c (patch)
tree2409ee3fa7ad3c9c5f207324f44d0f67bf4befd4 /libs/ardour/session_state.cc
parent908369ab3e31f82eae3734cfe61421912d2fba6a (diff)
Let the user add a template description on saving session templates
Diffstat (limited to 'libs/ardour/session_state.cc')
-rw-r--r--libs/ardour/session_state.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 0a1eb2ace6..0bf09f76c6 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -2356,7 +2356,7 @@ Session::XMLSourceFactory (const XMLNode& node)
}
int
-Session::save_template (string template_name, bool replace_existing)
+Session::save_template (const string& template_name, const string& description, bool replace_existing)
{
if ((_state_of_the_state & CannotSave) || template_name.empty ()) {
return -1;
@@ -2411,12 +2411,22 @@ Session::save_template (string template_name, bool replace_existing)
SessionSaveUnderway (); /* EMIT SIGNAL */
XMLTree tree;
-
+ XMLNode* root;
{
PBD::Unwinder<std::string> uw (_template_state_dir, template_dir_path);
- tree.set_root (&get_template());
+ root = &get_template();
+ }
+
+ if (!description.empty()) {
+ XMLNode* desc = new XMLNode(X_("description"));
+ XMLNode* desc_cont = new XMLNode(X_("content"), description);
+ desc->add_child_nocopy (*desc_cont);
+
+ root->add_child_nocopy (*desc);
}
+ tree.set_root (root);
+
if (!tree.write (template_file_path)) {
error << _("template not saved") << endmsg;
return -1;