summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-11-24 22:11:19 +0100
committerRobin Gareus <robin@gareus.org>2016-11-24 22:11:19 +0100
commit91ee1b6186f1ef039f5765e54675e7418ddabb35 (patch)
tree1ea483961283e9f8412f8383fec39e69916efebf /gtk2_ardour
parenta7210d256e70fe2deab3b18bf6ed3e847da7e19b (diff)
Don't allow duplicate playlist names
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/route_time_axis.cc21
1 files changed, 13 insertions, 8 deletions
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc
index 21ff5f8063..7bb41cf8ec 100644
--- a/gtk2_ardour/route_time_axis.cc
+++ b/gtk2_ardour/route_time_axis.cc
@@ -1124,20 +1124,25 @@ RouteTimeAxisView::rename_current_playlist ()
prompter.set_title (_("Rename Playlist"));
prompter.set_prompt (_("New name for playlist:"));
- prompter.set_initial_text (pl->name());
prompter.add_button (_("Rename"), Gtk::RESPONSE_ACCEPT);
+ prompter.set_initial_text (pl->name());
prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false);
- switch (prompter.run ()) {
- case Gtk::RESPONSE_ACCEPT:
+ while (true) {
+ if (prompter.run () != Gtk::RESPONSE_ACCEPT) {
+ break;
+ }
prompter.get_result (name);
if (name.length()) {
- pl->set_name (name);
+ if (_session->playlists->by_name (name)) {
+ MessageDialog msg (_("Given playlist name is not unique."));
+ msg.run ();
+ prompter.set_initial_text (Playlist::bump_name (name, *_session));
+ } else {
+ pl->set_name (name);
+ break;
+ }
}
- break;
-
- default:
- break;
}
}