cleaning, change getCount to numberOfWorkspaces
fluxgen fluxgen
4 files changed,
27 insertions(+),
12 deletions(-)
M
src/IconMenu.cc
→
src/IconMenu.cc
@@ -32,8 +32,8 @@ #include <typeinfo>
static void updateItems(FbTk::Menu &menu, BScreen &screen) { menu.removeAll(); - BScreen::Icons::iterator it = screen.getIconList().begin(); - BScreen::Icons::iterator it_end = screen.getIconList().end(); + BScreen::Icons::iterator it = screen.iconList().begin(); + BScreen::Icons::iterator it_end = screen.iconList().end(); for (; it != it_end; ++it) { FluxboxWindow::ClientList::iterator client_it = (*it)->clientList().begin(); FluxboxWindow::ClientList::iterator client_it_end = (*it)->clientList().end();
M
src/MenuCreator.cc
→
src/MenuCreator.cc
@@ -290,8 +290,8 @@ } // end of wallpapers
else if (str_key == "workspaces") { BScreen *screen = Fluxbox::instance()->findScreen(screen_number); if (screen != 0) { - screen->getWorkspacemenu().setInternalMenu(); - menu.insert(str_label.c_str(), &screen->getWorkspacemenu()); + screen->workspaceMenu().setInternalMenu(); + menu.insert(str_label.c_str(), &screen->workspaceMenu()); } } else if (str_key == "separator") { menu.insert(new FbTk::MenuSeparator());
M
src/WorkspaceCmd.cc
→
src/WorkspaceCmd.cc
@@ -127,7 +127,7 @@ JumpToWorkspaceCmd::JumpToWorkspaceCmd(int workspace_num):m_workspace_num(workspace_num) { }
void JumpToWorkspaceCmd::execute() { BScreen *screen = Fluxbox::instance()->mouseScreen(); - if (screen != 0 && m_workspace_num >= 0 && m_workspace_num < screen->getNumberOfWorkspaces()) + if (screen != 0) screen->changeWorkspaceID(m_workspace_num); }
M
src/WorkspaceMenu.cc
→
src/WorkspaceMenu.cc
@@ -29,9 +29,11 @@ #include "Workspace.hh"
#include "WorkspaceCmd.hh" #include "MenuCreator.hh" #include "CommandParser.hh" +#include "FbCommands.hh" #include "FbTk/I18n.hh" #include "FbTk/SimpleCommand.hh" +#include "FbTk/MacroCommand.hh" #include "FbTk/RefCount.hh" #include "FbTk/MenuItem.hh" #include "FbTk/MenuSeparator.hh"@@ -71,7 +73,7 @@ BScreen::ScreenSubject &screen_subj = *static_cast<BScreen::ScreenSubject *>(subj);
BScreen &screen = screen_subj.screen(); if (subj == &screen.currentWorkspaceSig()) { FbTk::MenuItem *item = 0; - for (unsigned int i = 0; i < screen.getCount(); ++i) { + for (unsigned int i = 0; i < screen.numberOfWorkspaces(); ++i) { item = find(i + IDX_AFTER_ICONS); if (item && item->isSelected()) { setItemSelected(i + IDX_AFTER_ICONS, false);@@ -88,7 +90,7 @@ remove(IDX_AFTER_ICONS);
} // for each workspace add workspace name and it's menu // to our workspace menu - for (size_t workspace = 0; workspace < screen.getCount(); + for (size_t workspace = 0; workspace < screen.numberOfWorkspaces(); ++workspace) { Workspace *wkspc = screen.getWorkspace(workspace); wkspc->menu().setInternalMenu();@@ -121,7 +123,7 @@ insert(_FBTEXT(Menu, Icons, "Icons", "Iconic windows menu title"),
MenuCreator::createMenuType("iconmenu", screen.screenNumber())); insert(new FbTk::MenuSeparator()); // for each workspace add workspace name and it's menu to our workspace menu - for (size_t workspace = 0; workspace < screen.getCount(); ++workspace) { + for (size_t workspace = 0; workspace < screen.numberOfWorkspaces(); ++workspace) { Workspace *wkspc = screen.getWorkspace(workspace); wkspc->menu().setInternalMenu(); FbTk::MultiButtonMenuItem* mb_menu = new FbTk::MultiButtonMenuItem(5,@@ -133,17 +135,30 @@ insert(mb_menu, workspace + IDX_AFTER_ICONS);
} setItemSelected(screen.currentWorkspace()->workspaceID() + IDX_AFTER_ICONS, true); - RefCount<Command> new_workspace(new SimpleCommand<BScreen, int>(screen, &BScreen::addWorkspace)); - RefCount<Command> remove_last(new SimpleCommand<BScreen, int>(screen, &BScreen::removeLastWorkspace)); + + RefCount<Command> saverc_cmd(new FbCommands::SaveResources()); + + MacroCommand *new_workspace_macro = new MacroCommand(); + RefCount<Command> addworkspace(new SimpleCommand<BScreen, int>(screen, &BScreen::addWorkspace)); + new_workspace_macro->add(addworkspace); + new_workspace_macro->add(saverc_cmd); + RefCount<Command> new_workspace_cmd(new_workspace_macro); + + MacroCommand *remove_workspace_macro = new MacroCommand(); + RefCount<Command> rmworkspace(new SimpleCommand<BScreen, int>(screen, &BScreen::removeLastWorkspace)); + remove_workspace_macro->add(rmworkspace); + remove_workspace_macro->add(saverc_cmd); + RefCount<Command> remove_last_cmd(remove_workspace_macro); + RefCount<Command> start_edit(CommandParser::instance().parseLine("setworkspacenamedialog")); insert(new FbTk::MenuSeparator()); insert(_FBTEXT(Workspace, NewWorkspace, "New Workspace", "Add a new workspace"), - new_workspace); + new_workspace_cmd); insert(_FBTEXT(Toolbar, EditWkspcName, "Edit current workspace name", "Edit current workspace name"), start_edit); insert(_FBTEXT(Workspace, RemoveLast, "Remove Last", "Remove the last workspace"), - remove_last); + remove_last_cmd); updateMenu(); }