Do not set the statusbar message in GuiView::toolbar(). We don't really want to see the statusbar message when this function is called from initToolbars or from LFUN_COMMAND_EXECUTE. Instead, set the message in getStatus to indicate why the LFUN cannot be executed.

Also, disable the LFUN if the toolbar is not found.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33278 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2010-01-30 16:07:53 +00:00
parent 8186ecfef9
commit 6ab07eb870

View File

@ -507,7 +507,6 @@ GuiToolbar * GuiView::toolbar(string const & name)
return it->second;
LYXERR(Debug::GUI, "Toolbar::display: no toolbar named " << name);
message(bformat(_("Unknown toolbar \"%1$s\""), from_utf8(name)));
return 0;
}
@ -1441,10 +1440,18 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
enable = d.currentTabWorkArea();
break;
case LFUN_TOOLBAR_TOGGLE:
if (GuiToolbar * t = toolbar(cmd.getArg(0)))
case LFUN_TOOLBAR_TOGGLE: {
string const name = cmd.getArg(0);
if (GuiToolbar * t = toolbar(name))
flag.setOnOff(t->isVisible());
else {
enable = false;
docstring const msg =
bformat(_("Unknown toolbar \"%1$s\""), from_utf8(name));
flag.message(msg);
}
break;
}
case LFUN_DROP_LAYOUTS_CHOICE:
enable = buf;