Allow strips to add or remove personal sends
[ardour.git] / gtk2_ardour / template_dialog.cc
index a5bbcd4089cd20397b135eed2dcba22f2c680a2c..e250791b62b6550e9c0861e632d740bcdfafd832 100644 (file)
@@ -45,6 +45,7 @@
 
 #include "gtkmm2ext/gui_thread.h"
 
+#include "ardour/filename_extensions.h"
 #include "ardour/filesystem_paths.h"
 #include "ardour/template_utils.h"
 
@@ -312,7 +313,7 @@ TemplateManager::handle_dirty_description ()
        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 ();
@@ -489,13 +490,13 @@ TemplateManager::export_all_templates ()
        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);
 
@@ -507,9 +508,7 @@ TemplateManager::export_all_templates ()
        }
 
        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);
@@ -573,7 +572,7 @@ TemplateManager::import_template_set ()
        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);
 
@@ -708,6 +707,10 @@ SessionTemplateManager::rename_template (TreeModel::iterator& item, const Glib::
        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;
@@ -812,6 +815,10 @@ RouteTemplateManager::rename_template (TreeModel::iterator& item, const Glib::us
        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;