Save template description at toplevel rather than in <Metadata/>
[ardour.git] / libs / ardour / template_utils.cc
index 81a7f31078c5a377d0ea2a6188cff9b4d5a53fc9..13674cd51defcfcdd56ca5698edf319d2f6748b3 100644 (file)
@@ -33,6 +33,8 @@
 #include "ardour/search_paths.h"
 #include "ardour/io.h"
 
+#include "pbd/i18n.h"
+
 using namespace std;
 using namespace PBD;
 
@@ -94,17 +96,32 @@ find_session_templates (vector<TemplateInfo>& template_names, bool read_xml)
        for (vector<string>::iterator i = templates.begin(); i != templates.end(); ++i) {
                string file = session_template_dir_to_file (*i);
 
+               TemplateInfo rti;
+               rti.name = Glib::path_get_basename (*i);
+               rti.path = *i;
+
                if (read_xml) {
                        XMLTree tree;
                        if (!tree.read (file.c_str())) {
                                continue;
                        }
-               }
 
-               TemplateInfo rti;
+                       string created_with = "(unknown)";
+                       XMLNode *pv = tree.root()->child("ProgramVersion");
+                       if (pv != 0) {
+                               pv->get_property (X_("created-with"), created_with);
+                       }
 
-               rti.name = Glib::path_get_basename (*i);
-               rti.path = *i;
+                       string description = "No Description";
+                       XMLNode *desc = tree.root()->child("description");
+                       if (desc != 0) {
+                               description = desc->attribute_value();
+                       }
+
+                       rti.created_with = created_with;
+                       rti.description = description;
+
+               }
 
                template_names.push_back (rti);
        }