Make template descriptions editable in template manager
[ardour.git] / gtk2_ardour / template_dialog.cc
1 /*
2     Copyright (C) 2010 Paul Davis
3     Author: Johannes Mueller
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 */
20
21 #include <map>
22 #include <cerrno>
23
24 #include <glib/gstdio.h>
25
26 #include <gtkmm/filechooserdialog.h>
27 #include <gtkmm/frame.h>
28 #include <gtkmm/notebook.h>
29 #include <gtkmm/separator.h>
30 #include <gtkmm/scrolledwindow.h>
31 #include <gtkmm/stock.h>
32 #include <gtkmm/treeiter.h>
33
34 #include "pbd/basename.h"
35 #include "pbd/error.h"
36 #include "pbd/file_archive.h"
37 #include "pbd/file_utils.h"
38 #include "pbd/i18n.h"
39 #include "pbd/xml++.h"
40
41 #include "gtkmm2ext/gui_thread.h"
42
43 #include "ardour/filesystem_paths.h"
44 #include "ardour/template_utils.h"
45
46 #include "template_dialog.h"
47
48 using namespace std;
49 using namespace Gtk;
50 using namespace PBD;
51 using namespace ARDOUR;
52
53
54 TemplateDialog::TemplateDialog ()
55         : ArdourDialog ("Manage Templates")
56 {
57         Notebook* nb = manage (new Notebook);
58
59         SessionTemplateManager* session_tm = manage (new SessionTemplateManager);
60         nb->append_page (*session_tm, _("Session Templates"));
61
62         RouteTemplateManager* route_tm = manage (new RouteTemplateManager);
63         nb->append_page (*route_tm, _("Track Templates"));
64
65         get_vbox()->pack_start (*nb);
66         add_button (_("Ok"), Gtk::RESPONSE_OK);
67
68         get_vbox()->show_all();
69
70         session_tm->init ();
71         route_tm->init ();
72
73         session_tm->TemplatesImported.connect (*this, invalidator (*this), boost::bind (&RouteTemplateManager::init, route_tm), gui_context ());
74         route_tm->TemplatesImported.connect (*this, invalidator (*this), boost::bind (&SessionTemplateManager::init, session_tm), gui_context ());
75 }
76
77 TemplateManager::TemplateManager ()
78         : HBox ()
79         , ProgressReporter ()
80         , _save_desc (_("Save Description"))
81         , _desc_dirty (false)
82         , _remove_button (_("Remove"))
83         , _rename_button (_("Rename"))
84         , _export_all_templates_button (_("Export all"))
85         , _import_template_set_button (_("Import"))
86 {
87         _template_model = ListStore::create (_template_columns);
88         _template_treeview.set_model (_template_model);
89
90         _validated_column.set_title (_("Template Name"));
91         _validated_column.pack_start (_validating_cellrenderer);
92         _template_treeview.append_column (_validated_column);
93         _validating_cellrenderer.property_editable() = true;
94
95         _validated_column.set_cell_data_func (_validating_cellrenderer, sigc::mem_fun (*this, &TemplateManager::render_template_names));
96         _validating_cellrenderer.signal_edited().connect (sigc::mem_fun (*this, &TemplateManager::validate_edit));
97         _template_treeview.signal_cursor_changed().connect (sigc::mem_fun (*this, &TemplateManager::row_selection_changed));
98         _template_treeview.signal_key_press_event().connect (sigc::mem_fun (*this, &TemplateManager::key_event));
99
100         ScrolledWindow* sw = manage (new ScrolledWindow);
101         sw->property_hscrollbar_policy() = POLICY_AUTOMATIC;
102         sw->add (_template_treeview);
103         sw->set_size_request (300, 200);
104
105         VBox* vb_btns = manage (new VBox);
106         vb_btns->set_spacing (4);
107         vb_btns->pack_start (_rename_button, false, false);
108         vb_btns->pack_start (_remove_button, false, false);
109         vb_btns->pack_start (_save_desc, false, false);
110
111         _rename_button.set_sensitive (false);
112         _rename_button.signal_clicked().connect (sigc::mem_fun (*this, &TemplateManager::start_edit));
113         _remove_button.set_sensitive (false);
114         _remove_button.signal_clicked().connect (sigc::mem_fun (*this, &TemplateManager::delete_selected_template));
115
116         vb_btns->pack_start (*(manage (new VSeparator ())));
117
118         vb_btns->pack_start (_export_all_templates_button, false, false);
119         vb_btns->pack_start (_import_template_set_button, false, false);
120
121         _export_all_templates_button.set_sensitive (false);
122         _export_all_templates_button.signal_clicked().connect (sigc::mem_fun (*this, &TemplateManager::export_all_templates));
123
124         _import_template_set_button.set_sensitive (true);
125         _import_template_set_button.signal_clicked().connect (sigc::mem_fun (*this, &TemplateManager::import_template_set));
126
127         set_spacing (6);
128
129         VBox* vb = manage (new VBox);
130         vb->pack_start (*sw);
131         vb->pack_start (_progress_bar);
132
133         Frame* desc_frame = manage (new Frame (_("Description")));
134
135         _description_editor.set_wrap_mode (Gtk::WRAP_WORD);
136         _description_editor.set_size_request (300,400);
137         _description_editor.set_border_width (6);
138
139         _save_desc.set_sensitive (false);
140         _save_desc.signal_clicked().connect (sigc::mem_fun (*this, &TemplateManager::save_template_desc));
141
142         _description_editor.get_buffer()->signal_changed().connect (sigc::mem_fun (*this, &TemplateManager::set_desc_dirty));
143
144         desc_frame->add (_description_editor);
145
146         pack_start (*vb);
147         pack_start (*desc_frame);
148         pack_start (*vb_btns);
149
150         show_all_children ();
151         _progress_bar.hide ();
152 }
153
154 void
155 TemplateManager::setup_model (const vector<TemplateInfo>& templates)
156 {
157         _template_model->clear ();
158
159         for (vector<TemplateInfo>::const_iterator it = templates.begin(); it != templates.end(); ++it) {
160                 TreeModel::Row row;
161                 row = *(_template_model->append ());
162
163                 row[_template_columns.name] = it->name;
164                 row[_template_columns.path] = it->path;
165                 row[_template_columns.description] = it->description;
166         }
167
168         _export_all_templates_button.set_sensitive (!templates.empty ());
169 }
170
171 void
172 TemplateManager::row_selection_changed ()
173 {
174         bool has_selection = false;
175         if (_template_treeview.get_selection()->count_selected_rows () != 0) {
176                 Gtk::TreeModel::const_iterator it = _template_treeview.get_selection()->get_selected ();
177                 if (it) {
178                         has_selection = true;
179                         const string desc = it->get_value (_template_columns.description);
180                         _description_editor.get_buffer()->set_text (desc);
181                         _desc_dirty = false;
182                         _save_desc.set_sensitive (false);
183                 }
184         }
185
186         _rename_button.set_sensitive (has_selection);
187         _remove_button.set_sensitive (has_selection);
188 }
189
190 void
191 TemplateManager::render_template_names (Gtk::CellRenderer*, const Gtk::TreeModel::iterator& it)
192 {
193         if (it) {
194                 _validating_cellrenderer.property_text () = it->get_value (_template_columns.name);
195         }
196 }
197
198 void
199 TemplateManager::validate_edit (const Glib::ustring& path_string, const Glib::ustring& new_name)
200 {
201         const TreePath path (path_string);
202         TreeModel::iterator current = _template_model->get_iter (path);
203
204         if (current->get_value (_template_columns.name) == new_name) {
205                 return;
206         }
207
208         TreeModel::Children rows = _template_model->children ();
209
210         bool found = false;
211         for (TreeModel::Children::const_iterator it = rows.begin(); it != rows.end(); ++it) {
212                 if (it->get_value (_template_columns.name) == new_name) {
213                         found = true;
214                         break;
215                 }
216         }
217
218         if (found) {
219                 error << string_compose (_("Template of name \"%1\" already exists"), new_name) << endmsg;
220                 return;
221         }
222
223
224         rename_template (current, new_name);
225 }
226
227 void
228 TemplateManager::start_edit ()
229 {
230         TreeModel::Path path;
231         TreeViewColumn* col;
232         _template_treeview.get_cursor (path, col);
233         _template_treeview.set_cursor (path, *col, /*set_editing =*/ true);
234 }
235
236 void
237 TemplateManager::set_desc_dirty ()
238 {
239         _desc_dirty = true;
240         _save_desc.set_sensitive (true);
241 }
242
243 void
244 TemplateManager::save_template_desc ()
245 {
246         const Gtk::TreeModel::const_iterator it = _template_treeview.get_selection()->get_selected ();
247         const string file_path = template_file (it);
248
249         const string desc_txt = _description_editor.get_buffer()->get_text ();
250         it->set_value (_template_columns.description, desc_txt);
251
252         XMLTree tree;
253
254         if (!tree.read(file_path)) {
255                 error << string_compose (_("Could not parse template file \"%1\"."), file_path) << endmsg;
256                 return;
257         }
258
259         XMLNode* md = tree.root()->child (X_("Metadata"));
260         if (!md) {
261                 md = new XMLNode (X_("Metadata"));
262                 tree.root()->add_child_nocopy (*md);
263         }
264         XMLNode* desc = md->child (X_("description"));
265         if (!desc) {
266                 desc = new XMLNode (X_("description"));
267                 md->add_child_nocopy (*desc);
268         }
269         XMLNode* dn = new XMLNode (X_("content"), desc_txt);
270         desc->add_child_nocopy (*dn);
271
272         if (!tree.write ()) {
273                 error << string_compose(X_("Could not write to template file \"%1\"."), file_path) << endmsg;
274                 return;
275         }
276
277         _save_desc.set_sensitive (false);
278         _desc_dirty = false;
279 }
280
281 bool
282 TemplateManager::key_event (GdkEventKey* ev)
283 {
284         if (ev->keyval == GDK_KEY_F2) {
285                 start_edit ();
286                 return true;
287         }
288         if (ev->keyval == GDK_KEY_Delete) {
289                 delete_selected_template ();
290                 return true;
291         }
292
293         return false;
294 }
295
296 static
297 bool accept_all_files (string const &, void *)
298 {
299         return true;
300 }
301
302 static void _set_progress (Progress* p, size_t n, size_t t)
303 {
304         p->set_progress (float (n) / float(t));
305 }
306
307
308 void
309 TemplateManager::export_all_templates ()
310 {
311         GError* err = NULL;
312         char* td = g_dir_make_tmp ("ardour-templates-XXXXXX", &err);
313
314         if (!td) {
315                 error << string_compose(_("Could not make tmpdir: %1"), err->message) << endmsg;
316                 return;
317         }
318         const string tmpdir (td);
319         g_free (td);
320         g_clear_error (&err);
321
322         FileChooserDialog dialog(_("Save Exported Template Archive"), FILE_CHOOSER_ACTION_SAVE);
323         dialog.set_filename (X_("templates.tar.xz"));
324
325         dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
326         dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
327
328         FileFilter archive_filter;
329         archive_filter.add_pattern (X_("*.tar.xz"));
330         archive_filter.set_name (_("Template archives"));
331         dialog.add_filter (archive_filter);
332
333         int result = dialog.run ();
334
335         if (result != RESPONSE_OK || !dialog.get_filename().length()) {
336                 PBD::remove_directory (tmpdir);
337                 return;
338         }
339
340         string filename = dialog.get_filename ();
341         if (filename.compare (filename.size () - 7, 7, ".tar.xz")) {
342                 filename += ".tar.xz";
343         }
344
345         if (g_file_test (filename.c_str(), G_FILE_TEST_EXISTS)) {
346                 ArdourDialog dlg (_("File exists"), true);
347                 Label msg (string_compose (_("The file %1 already exists."), filename));
348                 dlg.get_vbox()->pack_start (msg);
349                 msg.show ();
350                 dlg.add_button (_("Overwrite"), RESPONSE_ACCEPT);
351                 dlg.add_button (_("Cancel"), RESPONSE_REJECT);
352                 dlg.set_default_response (RESPONSE_REJECT);
353
354                 result = dlg.run ();
355
356                 if (result == RESPONSE_REJECT) {
357                         PBD::remove_directory (tmpdir);
358                         return;
359                 }
360         }
361
362         PBD::copy_recurse (templates_dir (), Glib::build_filename (tmpdir, Glib::path_get_basename (templates_dir ())));
363
364         vector<string> files;
365         PBD::find_files_matching_regex (files, tmpdir, string ("\\.template$"), /* recurse = */ true);
366
367         vector<string>::const_iterator it;
368         for (it = files.begin(); it != files.end(); ++it) {
369                 const string bn = PBD::basename_nosuffix (*it);
370                 const string old_path = Glib::build_filename (templates_dir (), bn);
371                 const string new_path = Glib::build_filename ("$TEMPLATEDIR", bn);
372
373                 XMLTree tree;
374                 if (!tree.read (*it)) {
375                         continue;
376                 }
377                 if (adjust_xml_tree (tree, old_path, new_path)) {
378                         tree.write (*it);
379                 }
380         }
381
382         find_files_matching_filter (files, tmpdir, accept_all_files, 0, false, true, true);
383
384         std::map<std::string, std::string> filemap;
385         for (it = files.begin(); it != files.end(); ++it) {
386                 filemap[*it] = it->substr (tmpdir.size()+1, it->size() - tmpdir.size() - 1);
387         }
388
389         _current_action = _("Exporting templates");
390
391         PBD::FileArchive ar (filename);
392         PBD::ScopedConnectionList progress_connection;
393         ar.progress.connect_same_thread (progress_connection, boost::bind (&_set_progress, this, _1, _2));
394         ar.create (filemap);
395
396         PBD::remove_directory (tmpdir);
397 }
398
399 void
400 TemplateManager::import_template_set ()
401 {
402         FileChooserDialog dialog (_("Import template archives"));
403         dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
404         dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
405
406         FileFilter archive_filter;
407         archive_filter.add_pattern (X_("*.tar.xz"));
408         archive_filter.set_name (_("Template archives"));
409         dialog.add_filter (archive_filter);
410
411         int result = dialog.run ();
412
413         if (result != RESPONSE_OK || !dialog.get_filename().length()) {
414                 return;
415         }
416
417         _current_action = _("Importing templates");
418
419         FileArchive ar (dialog.get_filename ());
420         PBD::ScopedConnectionList progress_connection;
421         ar.progress.connect_same_thread (progress_connection, boost::bind (&_set_progress, this, _1, _2));
422         ar.inflate (user_config_directory ());
423
424         vector<string> files;
425         PBD::find_files_matching_regex (files, templates_dir (), string ("\\.template$"), /* recurse = */ true);
426
427         vector<string>::const_iterator it;
428         for (it = files.begin(); it != files.end(); ++it) {
429                 const string bn = PBD::basename_nosuffix (*it);
430                 const string old_path = Glib::build_filename ("$TEMPLATEDIR", bn);
431                 const string new_path = Glib::build_filename (templates_dir (), bn);
432
433                 XMLTree tree;
434                 if (!tree.read (*it)) {
435                         continue;
436                 }
437                 if (adjust_xml_tree (tree, old_path, new_path)) {
438                         tree.write (*it);
439                 }
440         }
441
442         init ();
443         TemplatesImported (); /* emit signal */
444 }
445
446 bool
447 TemplateManager::adjust_plugin_paths (XMLNode* node, const string& name, const string& new_name) const
448 {
449         bool adjusted = false;
450
451         const XMLNodeList& procs = node->children (X_("Processor"));
452         XMLNodeConstIterator pit;
453         for (pit = procs.begin(); pit != procs.end(); ++pit) {
454                 XMLNode* lv2_node = (*pit)->child (X_("lv2"));
455                 if (!lv2_node) {
456                         continue;
457                 }
458                 string template_dir;
459
460                 if (!lv2_node->get_property (X_("template-dir"), template_dir)) {
461                         continue;
462                 }
463
464                 const int suffix_pos = template_dir.size() - name.size();
465                 if (suffix_pos < 0) {
466                         cerr << "Template name\"" << name << "\" longer than template-dir \"" << template_dir << "\", WTH?" << endl;
467                         continue;
468                 }
469
470                 if (template_dir.compare (suffix_pos, template_dir.size(), name)) {
471                         cerr << "Template name \"" << name << "\" no suffix of template-dir \"" << template_dir << "\"" << endl;
472                         continue;
473                 }
474
475                 const string new_template_dir = template_dir.substr (0, suffix_pos) + new_name;
476                 lv2_node->set_property (X_("template-dir"), new_template_dir);
477
478                 adjusted = true;
479         }
480
481         return adjusted;
482 }
483
484 void
485 TemplateManager::update_progress_gui (float p)
486 {
487         if (p >= 1.0) {
488                 _progress_bar.hide ();
489                 return;
490         }
491
492         _progress_bar.show ();
493         _progress_bar.set_text (_current_action);
494         _progress_bar.set_fraction (p);
495 }
496
497
498 void SessionTemplateManager::init ()
499 {
500         vector<TemplateInfo> templates;
501         find_session_templates (templates, /* read_xml = */ true);
502         setup_model (templates);
503
504         _progress_bar.hide ();
505 }
506
507 void RouteTemplateManager::init ()
508 {
509         vector<TemplateInfo> templates;
510         find_route_templates (templates);
511         setup_model (templates);
512
513         _progress_bar.hide ();
514 }
515
516 #include <cerrno>
517
518 void
519 SessionTemplateManager::rename_template (TreeModel::iterator& item, const Glib::ustring& new_name_)
520 {
521         const string old_path = item->get_value (_template_columns.path);
522         const string old_name = item->get_value (_template_columns.name);
523         const string new_name = string (new_name_);
524
525         const string old_file_old_path = Glib::build_filename (old_path, old_name+".template");
526
527         XMLTree tree;
528
529         if (!tree.read(old_file_old_path)) {
530                 error << string_compose (_("Could not parse template file \"%1\"."), old_file_old_path) << endmsg;
531                 return;
532         }
533         XMLNode* root = tree.root();
534
535         const XMLNode* const routes_node = root->child (X_("Routes"));
536         if (routes_node) {
537                 const XMLNodeList& routes = routes_node->children (X_("Route"));
538                 XMLNodeConstIterator rit;
539                 for (rit = routes.begin(); rit != routes.end(); ++rit) {
540                         adjust_plugin_paths (*rit, old_name, new_name);
541                 }
542         }
543
544         const string new_file_old_path = Glib::build_filename (old_path, new_name+".template");
545
546         tree.set_filename (new_file_old_path);
547
548         if (!tree.write ()) {
549                 error << string_compose(_("Could not write to new template file \"%1\"."), new_file_old_path);
550                 return;
551         }
552
553         const string new_path = Glib::build_filename (user_template_directory (), new_name);
554
555         if (g_rename (old_path.c_str(), new_path.c_str()) != 0) {
556                 error << string_compose (_("Could not rename template directory from \"%1\" to \"%2\": %3"),
557                                          old_path, new_path, strerror (errno)) << endmsg;
558                 g_unlink (new_file_old_path.c_str());
559                 return;
560         }
561
562         const string old_file_new_path = Glib::build_filename (new_path, old_name+".template");
563         if (g_unlink (old_file_new_path.c_str())) {
564                 error << string_compose (X_("Could not delete old template file \"%1\": %2"),
565                                          old_file_new_path, strerror (errno)) << endmsg;
566         }
567
568         item->set_value (_template_columns.name, new_name);
569         item->set_value (_template_columns.path, new_path);
570 }
571
572 void
573 SessionTemplateManager::delete_selected_template ()
574 {
575         if (_template_treeview.get_selection()->count_selected_rows() == 0) {
576                 return;
577         }
578
579         Gtk::TreeModel::const_iterator it = _template_treeview.get_selection()->get_selected();
580
581         if (!it) {
582                 return;
583         }
584
585         PBD::remove_directory (it->get_value (_template_columns.path));
586
587         _template_model->erase (it);
588         row_selection_changed ();
589 }
590
591 string
592 SessionTemplateManager::templates_dir () const
593 {
594         return user_template_directory ();
595 }
596
597
598 string
599 SessionTemplateManager::template_file (const TreeModel::const_iterator& item) const
600 {
601         const string path = item->get_value (_template_columns.path);
602         const string name = item->get_value (_template_columns.name);
603         return Glib::build_filename (path, name+".template");
604 }
605
606 bool
607 SessionTemplateManager::adjust_xml_tree (XMLTree& tree, const std::string& old_name, const std::string& new_name) const
608 {
609         bool adjusted = false;
610         XMLNode* root = tree.root();
611
612         const XMLNode* const routes_node = root->child (X_("Routes"));
613         if (routes_node) {
614                 const XMLNodeList& routes = routes_node->children (X_("Route"));
615                 XMLNodeConstIterator rit;
616                 for (rit = routes.begin(); rit != routes.end(); ++rit) {
617                         if (adjust_plugin_paths (*rit, old_name, new_name)) {
618                                 adjusted = true;
619                         }
620                 }
621         }
622
623         return adjusted;
624 }
625
626
627 void
628 RouteTemplateManager::rename_template (TreeModel::iterator& item, const Glib::ustring& new_name)
629 {
630         const string old_name = item->get_value (_template_columns.name);
631         const string old_filepath = item->get_value (_template_columns.path);
632         const string new_filepath = Glib::build_filename (user_route_template_directory(), new_name+".template");
633
634         XMLTree tree;
635         if (!tree.read (old_filepath)) {
636                 error << string_compose (_("Could not parse template file \"%1\"."), old_filepath) << endmsg;
637                 return;
638         }
639         tree.root()->set_property (X_("name"), new_name);
640         tree.root()->children().front()->set_property (X_("name"), new_name);
641
642         const bool adjusted = adjust_plugin_paths (tree.root(), old_name, string (new_name));
643
644         const string old_state_dir = Glib::build_filename (user_route_template_directory(), old_name);
645         const string new_state_dir = Glib::build_filename (user_route_template_directory(), new_name);
646
647         if (adjusted) {
648                 if (g_file_test (old_state_dir.c_str(), G_FILE_TEST_EXISTS)) {
649                         if (g_rename (old_state_dir.c_str(), new_state_dir.c_str()) != 0) {
650                                 error << string_compose (_("Could not rename state dir \"%1\" to \"%22\": %3"), old_state_dir, new_state_dir, strerror (errno)) << endmsg;
651                                 return;
652                         }
653                 }
654         }
655
656         tree.set_filename (new_filepath);
657
658         if (!tree.write ()) {
659                 error << string_compose(_("Could not write new template file \"%1\"."), new_filepath) << endmsg;
660                 if (adjusted) {
661                         g_rename (new_state_dir.c_str(), old_state_dir.c_str());
662                 }
663                 return;
664         }
665
666         if (g_unlink (old_filepath.c_str()) != 0) {
667                 error << string_compose (_("Could not remove old template file \"%1\": %2"), old_filepath, strerror (errno)) << endmsg;
668         }
669
670         item->set_value (_template_columns.name, string (new_name));
671         item->set_value (_template_columns.path, new_filepath);
672 }
673
674 void
675 RouteTemplateManager::delete_selected_template ()
676 {
677         if (_template_treeview.get_selection()->count_selected_rows() == 0) {
678                 return;
679         }
680
681         Gtk::TreeModel::const_iterator it = _template_treeview.get_selection()->get_selected();
682
683         if (!it) {
684                 return;
685         }
686
687         const string file_path = it->get_value (_template_columns.path);
688
689         if (g_unlink (file_path.c_str()) != 0) {
690                 error << string_compose(_("Could not delete template file \"%1\": %2"), file_path, strerror (errno)) << endmsg;
691                 return;
692         }
693         PBD::remove_directory (Glib::build_filename (user_route_template_directory (), it->get_value (_template_columns.name)));
694
695         _template_model->erase (it);
696         row_selection_changed ();
697 }
698
699 string
700 RouteTemplateManager::templates_dir () const
701 {
702         return user_route_template_directory ();
703 }
704
705
706 string
707 RouteTemplateManager::template_file (const TreeModel::const_iterator& item) const
708 {
709         return item->get_value (_template_columns.path);
710 }
711
712 bool
713 RouteTemplateManager::adjust_xml_tree (XMLTree& tree, const std::string& old_name, const std::string& new_name) const
714 {
715         return adjust_plugin_paths (tree.root(), old_name, string (new_name));
716 }