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: svn://localhost/ardour2/branches/3.0@9953 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-08-03 13:28:36 +00:00
parent 86d2afaf4e
commit 61d95b0bd0
2 changed files with 15 additions and 13 deletions

View File

@ -1325,6 +1325,8 @@ RouteTimeAxisView::name_entry_changed ()
if (RouteUI::verify_new_route_name (x)) {
_route->set_name (x);
} else {
name_entry.grab_focus ();
}
}
}

View File

@ -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