bugfix: do not change workspaces when using NextWindow / PrevWindow buttons in toolbar

This commit is contained in:
Mathias Gumz 2011-09-01 17:08:50 +02:00
parent 0708d1e046
commit 6c82cd5f84

View file

@ -91,14 +91,19 @@ ToolbarItem *ToolFactory::create(const std::string &name, const FbTk::FbWindow &
} else if (name == "clock") {
item = new ClockTool(parent, m_clock_theme, screen(), tbar.menu());
} else {
FbTk::RefCount<FbTk::Command<void> > cmd(FbTk::CommandParser<void>::instance().parse(name));
std::string cmd_str = name;
if (name == "prevwindow" || name == "nextwindow") {
cmd_str += " (workspace=[current])";
}
FbTk::RefCount<FbTk::Command<void> > cmd(FbTk::CommandParser<void>::instance().parse(cmd_str));
if (cmd == 0) // we need a command
return 0;
// TODO maybe direction of arrows should depend on toolbar layout ?
FbTk::FbDrawable::TriangleType arrow_type = FbTk::FbDrawable::RIGHT;
const char *tmp = name.c_str();
if (FbTk::StringUtil::strcasestr(tmp, "prev"))
if (name.find("prev") != std::string::npos)
arrow_type = FbTk::FbDrawable::LEFT;
ArrowButton *win = new ArrowButton(arrow_type, parent,