From 03b97202489cbe9b3c843cda27acefba4723edbf Mon Sep 17 00:00:00 2001 From: carlh Date: Wed, 3 Aug 2011 13:28:36 +0000 Subject: [PATCH] Fix erroneous check for colons in track names; clean up the dialogue a bit and go back to the name entry if the user wants to re-edit. git-svn-id: http://subversion.ardour.org/svn/ardour2/ardour2/branches/3.0@9953 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/route_time_axis.cc | 2 ++ gtk2_ardour/route_ui.cc | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 3836f4cf6..360a9fb4c 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -1325,6 +1325,8 @@ RouteTimeAxisView::name_entry_changed () if (RouteUI::verify_new_route_name (x)) { _route->set_name (x); + } else { + name_entry.grab_focus (); } } } diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index d78102322..e7d893ddc 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -1349,23 +1349,23 @@ RouteUI::idle_remove_this_route (RouteUI *rui) return false; } +/** @return true if this name should be used for the route, otherwise false */ bool RouteUI::verify_new_route_name (const std::string& name) { - if (name.find (':')) { - MessageDialog colon_msg (_("The use of colons (':') is discouraged in track and bus names.\nDo you insist on using this?")); - colon_msg.add_button (Stock::CANCEL, RESPONSE_CANCEL); - switch (colon_msg.run()) { - case Gtk::RESPONSE_ACCEPT: - return true; - break; - default: - return false; - break; - } - } + if (name.find (':') == string::npos) { + return true; + } + + MessageDialog colon_msg ( + _("The use of colons (':') is discouraged in track and bus names.\nDo you want to use this new name?"), + false, MESSAGE_QUESTION, BUTTONS_NONE + ); + + colon_msg.add_button (_("Use the new name"), Gtk::RESPONSE_ACCEPT); + colon_msg.add_button (_("Re-edit the name"), Gtk::RESPONSE_CANCEL); - return true; + return (colon_msg.run () == Gtk::RESPONSE_ACCEPT); } void -- 2.11.4.GIT