#include "gtkmm2ext/gui_thread.h"
+#include "ardour/filename_extensions.h"
#include "ardour/filesystem_paths.h"
#include "ardour/template_utils.h"
if (_desc_dirty && _current_selection) {
ArdourDialog dlg (_("Description not saved"), true);
const string name = _current_selection->get_value (_template_columns.name);
- Label msg (string_compose (_("The discription of template \"%1\" has been modfied but has not been saved yet.\n"
+ Label msg (string_compose (_("The description of template \"%1\" has been modified but has not been saved yet.\n"
"Do you want to save it?"), name));
dlg.get_vbox()->pack_start (msg);
msg.show ();
g_clear_error (&err);
FileChooserDialog dialog(_("Save Exported Template Archive"), FILE_CHOOSER_ACTION_SAVE);
- dialog.set_filename (X_("templates.tar.xz"));
+ dialog.set_filename (X_("templates"));
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
FileFilter archive_filter;
- archive_filter.add_pattern (X_("*.tar.xz"));
+ archive_filter.add_pattern (string_compose(X_("*%1"), ARDOUR::template_archive_suffix));
archive_filter.set_name (_("Template archives"));
dialog.add_filter (archive_filter);
}
string filename = dialog.get_filename ();
- if (filename.compare (filename.size () - 7, 7, ".tar.xz")) {
- filename += ".tar.xz";
- }
+ filename += ARDOUR::template_archive_suffix;
if (g_file_test (filename.c_str(), G_FILE_TEST_EXISTS)) {
ArdourDialog dlg (_("File exists"), true);
dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
FileFilter archive_filter;
- archive_filter.add_pattern (X_("*.tar.xz"));
+ archive_filter.add_pattern (string_compose(X_("*%1"), ARDOUR::template_archive_suffix));
archive_filter.set_name (_("Template archives"));
dialog.add_filter (archive_filter);
const string old_name = item->get_value (_template_columns.name);
const string new_name = string (new_name_);
+ if (old_name == new_name) {
+ return;
+ }
+
const string old_file_old_path = Glib::build_filename (old_path, old_name+".template");
XMLTree tree;
const string old_filepath = item->get_value (_template_columns.path);
const string new_filepath = Glib::build_filename (user_route_template_directory(), new_name+".template");
+ if (old_name == new_name) {
+ return;
+ }
+
XMLTree tree;
if (!tree.read (old_filepath)) {
error << string_compose (_("Could not parse template file \"%1\"."), old_filepath) << endmsg;