Remove the template description XMLNode before saving the template
[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         tree.root()->remove_nodes (X_("description"));
260         XMLNode* desc = new XMLNode (X_("description"));
261
262         XMLNode* dn = new XMLNode (X_("content"), desc_txt);
263         desc->add_child_nocopy (*dn);
264
265         tree.root()->add_child_nocopy (*desc);
266
267         if (!tree.write ()) {
268                 error << string_compose(X_("Could not write to template file \"%1\"."), file_path) << endmsg;
269                 return;
270         }
271
272         _save_desc.set_sensitive (false);
273         _desc_dirty = false;
274 }
275
276 bool
277 TemplateManager::key_event (GdkEventKey* ev)
278 {
279         if (ev->keyval == GDK_KEY_F2) {
280                 start_edit ();
281                 return true;
282         }
283         if (ev->keyval == GDK_KEY_Delete) {
284                 delete_selected_template ();
285                 return true;
286         }
287
288         return false;
289 }
290
291 static
292 bool accept_all_files (string const &, void *)
293 {
294         return true;
295 }
296
297 static void _set_progress (Progress* p, size_t n, size_t t)
298 {
299         p->set_progress (float (n) / float(t));
300 }
301
302
303 void
304 TemplateManager::export_all_templates ()
305 {
306         GError* err = NULL;
307         char* td = g_dir_make_tmp ("ardour-templates-XXXXXX", &err);
308
309         if (!td) {
310                 error << string_compose(_("Could not make tmpdir: %1"), err->message) << endmsg;
311                 return;
312         }
313         const string tmpdir (td);
314         g_free (td);
315         g_clear_error (&err);
316
317         FileChooserDialog dialog(_("Save Exported Template Archive"), FILE_CHOOSER_ACTION_SAVE);
318         dialog.set_filename (X_("templates.tar.xz"));
319
320         dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
321         dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
322
323         FileFilter archive_filter;
324         archive_filter.add_pattern (X_("*.tar.xz"));
325         archive_filter.set_name (_("Template archives"));
326         dialog.add_filter (archive_filter);
327
328         int result = dialog.run ();
329
330         if (result != RESPONSE_OK || !dialog.get_filename().length()) {
331                 PBD::remove_directory (tmpdir);
332                 return;
333         }
334
335         string filename = dialog.get_filename ();
336         if (filename.compare (filename.size () - 7, 7, ".tar.xz")) {
337                 filename += ".tar.xz";
338         }
339
340         if (g_file_test (filename.c_str(), G_FILE_TEST_EXISTS)) {
341                 ArdourDialog dlg (_("File exists"), true);
342                 Label msg (string_compose (_("The file %1 already exists."), filename));
343                 dlg.get_vbox()->pack_start (msg);
344                 msg.show ();
345                 dlg.add_button (_("Overwrite"), RESPONSE_ACCEPT);
346                 dlg.add_button (_("Cancel"), RESPONSE_REJECT);
347                 dlg.set_default_response (RESPONSE_REJECT);
348
349                 result = dlg.run ();
350
351                 if (result == RESPONSE_REJECT) {
352                         PBD::remove_directory (tmpdir);
353                         return;
354                 }
355         }
356
357         PBD::copy_recurse (templates_dir (), Glib::build_filename (tmpdir, Glib::path_get_basename (templates_dir ())));
358
359         vector<string> files;
360         PBD::find_files_matching_regex (files, tmpdir, string ("\\.template$"), /* recurse = */ true);
361
362         vector<string>::const_iterator it;
363         for (it = files.begin(); it != files.end(); ++it) {
364                 const string bn = PBD::basename_nosuffix (*it);
365                 const string old_path = Glib::build_filename (templates_dir (), bn);
366                 const string new_path = Glib::build_filename ("$TEMPLATEDIR", bn);
367
368                 XMLTree tree;
369                 if (!tree.read (*it)) {
370                         continue;
371                 }
372                 if (adjust_xml_tree (tree, old_path, new_path)) {
373                         tree.write (*it);
374                 }
375         }
376
377         find_files_matching_filter (files, tmpdir, accept_all_files, 0, false, true, true);
378
379         std::map<std::string, std::string> filemap;
380         for (it = files.begin(); it != files.end(); ++it) {
381                 filemap[*it] = it->substr (tmpdir.size()+1, it->size() - tmpdir.size() - 1);
382         }
383
384         _current_action = _("Exporting templates");
385
386         PBD::FileArchive ar (filename);
387         PBD::ScopedConnectionList progress_connection;
388         ar.progress.connect_same_thread (progress_connection, boost::bind (&_set_progress, this, _1, _2));
389         ar.create (filemap);
390
391         PBD::remove_directory (tmpdir);
392 }
393
394 void
395 TemplateManager::import_template_set ()
396 {
397         FileChooserDialog dialog (_("Import template archives"));
398         dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
399         dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
400
401         FileFilter archive_filter;
402         archive_filter.add_pattern (X_("*.tar.xz"));
403         archive_filter.set_name (_("Template archives"));
404         dialog.add_filter (archive_filter);
405
406         int result = dialog.run ();
407
408         if (result != RESPONSE_OK || !dialog.get_filename().length()) {
409                 return;
410         }
411
412         _current_action = _("Importing templates");
413
414         FileArchive ar (dialog.get_filename ());
415         PBD::ScopedConnectionList progress_connection;
416         ar.progress.connect_same_thread (progress_connection, boost::bind (&_set_progress, this, _1, _2));
417         ar.inflate (user_config_directory ());
418
419         vector<string> files;
420         PBD::find_files_matching_regex (files, templates_dir (), string ("\\.template$"), /* recurse = */ true);
421
422         vector<string>::const_iterator it;
423         for (it = files.begin(); it != files.end(); ++it) {
424                 const string bn = PBD::basename_nosuffix (*it);
425                 const string old_path = Glib::build_filename ("$TEMPLATEDIR", bn);
426                 const string new_path = Glib::build_filename (templates_dir (), bn);
427
428                 XMLTree tree;
429                 if (!tree.read (*it)) {
430                         continue;
431                 }
432                 if (adjust_xml_tree (tree, old_path, new_path)) {
433                         tree.write (*it);
434                 }
435         }
436
437         init ();
438         TemplatesImported (); /* emit signal */
439 }
440
441 bool
442 TemplateManager::adjust_plugin_paths (XMLNode* node, const string& name, const string& new_name) const
443 {
444         bool adjusted = false;
445
446         const XMLNodeList& procs = node->children (X_("Processor"));
447         XMLNodeConstIterator pit;
448         for (pit = procs.begin(); pit != procs.end(); ++pit) {
449                 XMLNode* lv2_node = (*pit)->child (X_("lv2"));
450                 if (!lv2_node) {
451                         continue;
452                 }
453                 string template_dir;
454
455                 if (!lv2_node->get_property (X_("template-dir"), template_dir)) {
456                         continue;
457                 }
458
459                 const int suffix_pos = template_dir.size() - name.size();
460                 if (suffix_pos < 0) {
461                         cerr << "Template name\"" << name << "\" longer than template-dir \"" << template_dir << "\", WTH?" << endl;
462                         continue;
463                 }
464
465                 if (template_dir.compare (suffix_pos, template_dir.size(), name)) {
466                         cerr << "Template name \"" << name << "\" no suffix of template-dir \"" << template_dir << "\"" << endl;
467                         continue;
468                 }
469
470                 const string new_template_dir = template_dir.substr (0, suffix_pos) + new_name;
471                 lv2_node->set_property (X_("template-dir"), new_template_dir);
472
473                 adjusted = true;
474         }
475
476         return adjusted;
477 }
478
479 void
480 TemplateManager::update_progress_gui (float p)
481 {
482         if (p >= 1.0) {
483                 _progress_bar.hide ();
484                 return;
485         }
486
487         _progress_bar.show ();
488         _progress_bar.set_text (_current_action);
489         _progress_bar.set_fraction (p);
490 }
491
492
493 void SessionTemplateManager::init ()
494 {
495         vector<TemplateInfo> templates;
496         find_session_templates (templates, /* read_xml = */ true);
497         setup_model (templates);
498
499         _progress_bar.hide ();
500 }
501
502 void RouteTemplateManager::init ()
503 {
504         vector<TemplateInfo> templates;
505         find_route_templates (templates);
506         setup_model (templates);
507
508         _progress_bar.hide ();
509 }
510
511 #include <cerrno>
512
513 void
514 SessionTemplateManager::rename_template (TreeModel::iterator& item, const Glib::ustring& new_name_)
515 {
516         const string old_path = item->get_value (_template_columns.path);
517         const string old_name = item->get_value (_template_columns.name);
518         const string new_name = string (new_name_);
519
520         const string old_file_old_path = Glib::build_filename (old_path, old_name+".template");
521
522         XMLTree tree;
523
524         if (!tree.read(old_file_old_path)) {
525                 error << string_compose (_("Could not parse template file \"%1\"."), old_file_old_path) << endmsg;
526                 return;
527         }
528         XMLNode* root = tree.root();
529
530         const XMLNode* const routes_node = root->child (X_("Routes"));
531         if (routes_node) {
532                 const XMLNodeList& routes = routes_node->children (X_("Route"));
533                 XMLNodeConstIterator rit;
534                 for (rit = routes.begin(); rit != routes.end(); ++rit) {
535                         adjust_plugin_paths (*rit, old_name, new_name);
536                 }
537         }
538
539         const string new_file_old_path = Glib::build_filename (old_path, new_name+".template");
540
541         tree.set_filename (new_file_old_path);
542
543         if (!tree.write ()) {
544                 error << string_compose(_("Could not write to new template file \"%1\"."), new_file_old_path);
545                 return;
546         }
547
548         const string new_path = Glib::build_filename (user_template_directory (), new_name);
549
550         if (g_rename (old_path.c_str(), new_path.c_str()) != 0) {
551                 error << string_compose (_("Could not rename template directory from \"%1\" to \"%2\": %3"),
552                                          old_path, new_path, strerror (errno)) << endmsg;
553                 g_unlink (new_file_old_path.c_str());
554                 return;
555         }
556
557         const string old_file_new_path = Glib::build_filename (new_path, old_name+".template");
558         if (g_unlink (old_file_new_path.c_str())) {
559                 error << string_compose (X_("Could not delete old template file \"%1\": %2"),
560                                          old_file_new_path, strerror (errno)) << endmsg;
561         }
562
563         item->set_value (_template_columns.name, new_name);
564         item->set_value (_template_columns.path, new_path);
565 }
566
567 void
568 SessionTemplateManager::delete_selected_template ()
569 {
570         if (_template_treeview.get_selection()->count_selected_rows() == 0) {
571                 return;
572         }
573
574         Gtk::TreeModel::const_iterator it = _template_treeview.get_selection()->get_selected();
575
576         if (!it) {
577                 return;
578         }
579
580         PBD::remove_directory (it->get_value (_template_columns.path));
581
582         _template_model->erase (it);
583         row_selection_changed ();
584 }
585
586 string
587 SessionTemplateManager::templates_dir () const
588 {
589         return user_template_directory ();
590 }
591
592
593 string
594 SessionTemplateManager::template_file (const TreeModel::const_iterator& item) const
595 {
596         const string path = item->get_value (_template_columns.path);
597         const string name = item->get_value (_template_columns.name);
598         return Glib::build_filename (path, name+".template");
599 }
600
601 bool
602 SessionTemplateManager::adjust_xml_tree (XMLTree& tree, const std::string& old_name, const std::string& new_name) const
603 {
604         bool adjusted = false;
605         XMLNode* root = tree.root();
606
607         const XMLNode* const routes_node = root->child (X_("Routes"));
608         if (routes_node) {
609                 const XMLNodeList& routes = routes_node->children (X_("Route"));
610                 XMLNodeConstIterator rit;
611                 for (rit = routes.begin(); rit != routes.end(); ++rit) {
612                         if (adjust_plugin_paths (*rit, old_name, new_name)) {
613                                 adjusted = true;
614                         }
615                 }
616         }
617
618         return adjusted;
619 }
620
621
622 void
623 RouteTemplateManager::rename_template (TreeModel::iterator& item, const Glib::ustring& new_name)
624 {
625         const string old_name = item->get_value (_template_columns.name);
626         const string old_filepath = item->get_value (_template_columns.path);
627         const string new_filepath = Glib::build_filename (user_route_template_directory(), new_name+".template");
628
629         XMLTree tree;
630         if (!tree.read (old_filepath)) {
631                 error << string_compose (_("Could not parse template file \"%1\"."), old_filepath) << endmsg;
632                 return;
633         }
634         tree.root()->set_property (X_("name"), new_name);
635         tree.root()->children().front()->set_property (X_("name"), new_name);
636
637         const bool adjusted = adjust_plugin_paths (tree.root(), old_name, string (new_name));
638
639         const string old_state_dir = Glib::build_filename (user_route_template_directory(), old_name);
640         const string new_state_dir = Glib::build_filename (user_route_template_directory(), new_name);
641
642         if (adjusted) {
643                 if (g_file_test (old_state_dir.c_str(), G_FILE_TEST_EXISTS)) {
644                         if (g_rename (old_state_dir.c_str(), new_state_dir.c_str()) != 0) {
645                                 error << string_compose (_("Could not rename state dir \"%1\" to \"%22\": %3"), old_state_dir, new_state_dir, strerror (errno)) << endmsg;
646                                 return;
647                         }
648                 }
649         }
650
651         tree.set_filename (new_filepath);
652
653         if (!tree.write ()) {
654                 error << string_compose(_("Could not write new template file \"%1\"."), new_filepath) << endmsg;
655                 if (adjusted) {
656                         g_rename (new_state_dir.c_str(), old_state_dir.c_str());
657                 }
658                 return;
659         }
660
661         if (g_unlink (old_filepath.c_str()) != 0) {
662                 error << string_compose (_("Could not remove old template file \"%1\": %2"), old_filepath, strerror (errno)) << endmsg;
663         }
664
665         item->set_value (_template_columns.name, string (new_name));
666         item->set_value (_template_columns.path, new_filepath);
667 }
668
669 void
670 RouteTemplateManager::delete_selected_template ()
671 {
672         if (_template_treeview.get_selection()->count_selected_rows() == 0) {
673                 return;
674         }
675
676         Gtk::TreeModel::const_iterator it = _template_treeview.get_selection()->get_selected();
677
678         if (!it) {
679                 return;
680         }
681
682         const string file_path = it->get_value (_template_columns.path);
683
684         if (g_unlink (file_path.c_str()) != 0) {
685                 error << string_compose(_("Could not delete template file \"%1\": %2"), file_path, strerror (errno)) << endmsg;
686                 return;
687         }
688         PBD::remove_directory (Glib::build_filename (user_route_template_directory (), it->get_value (_template_columns.name)));
689
690         _template_model->erase (it);
691         row_selection_changed ();
692 }
693
694 string
695 RouteTemplateManager::templates_dir () const
696 {
697         return user_route_template_directory ();
698 }
699
700
701 string
702 RouteTemplateManager::template_file (const TreeModel::const_iterator& item) const
703 {
704         return item->get_value (_template_columns.path);
705 }
706
707 bool
708 RouteTemplateManager::adjust_xml_tree (XMLTree& tree, const std::string& old_name, const std::string& new_name) const
709 {
710         return adjust_plugin_paths (tree.root(), old_name, string (new_name));
711 }