diff options
author | Mathias Gumz <akira@fluxbox.org> | 2015-01-15 13:24:46 (GMT) |
---|---|---|
committer | Mathias Gumz <akira@fluxbox.org> | 2015-01-15 13:25:05 (GMT) |
commit | 8387742c8860694777f7c2c62da0a90c9e836988 (patch) | |
tree | e5bd5a50c3e033ea73a9339474750287d06aeb3f /src/WorkspaceMenu.cc | |
parent | b4cd45549013e8b45f95bf3e123cd14684948e91 (diff) | |
download | fluxbox-8387742c8860694777f7c2c62da0a90c9e836988.zip fluxbox-8387742c8860694777f7c2c62da0a90c9e836988.tar.bz2 |
Refactor menu code: be more explicit and compact
This commit is a preparation step for some menu cleanup ahead. To make it
easier to understand which types of MenuItems are added where and when, I
converted the overloaded FbTk::Menu::insert() functions into explicit ones
(Menu::insertSubmenu(), Menu::insertItem(), etc. ). This makes it possible
to just grep for 'insertSubmenu()'.
Side effect this commit: it trims down the very verbose creation of menu items
in regards to how the labels are created.
Minor: FbTk::Menu::shown and FbTk::Menu::s_focused are moved out of the class.
Diffstat (limited to 'src/WorkspaceMenu.cc')
-rw-r--r-- | src/WorkspaceMenu.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/WorkspaceMenu.cc b/src/WorkspaceMenu.cc index d73947b..d4be353 100644 --- a/src/WorkspaceMenu.cc +++ b/src/WorkspaceMenu.cc | |||
@@ -60,7 +60,7 @@ void add_workspaces(WorkspaceMenu& menu, BScreen& screen) { | |||
60 | FbTk::MultiButtonMenuItem* submenu = new FbTk::MultiButtonMenuItem(5, FbTk::BiDiString(w->name()), &w->menu()); | 60 | FbTk::MultiButtonMenuItem* submenu = new FbTk::MultiButtonMenuItem(5, FbTk::BiDiString(w->name()), &w->menu()); |
61 | FbTk::RefCount<FbTk::Command<void> > jump_cmd(new JumpToWorkspaceCmd(w->workspaceID())); | 61 | FbTk::RefCount<FbTk::Command<void> > jump_cmd(new JumpToWorkspaceCmd(w->workspaceID())); |
62 | submenu->setCommand(3, jump_cmd); | 62 | submenu->setCommand(3, jump_cmd); |
63 | menu.insert(submenu, i + IDX_AFTER_ICONS); | 63 | menu.insertItem(submenu, i + IDX_AFTER_ICONS); |
64 | } | 64 | } |
65 | } | 65 | } |
66 | 66 | ||
@@ -111,9 +111,9 @@ void WorkspaceMenu::init(BScreen &screen) { | |||
111 | removeAll(); | 111 | removeAll(); |
112 | 112 | ||
113 | setLabel(_FB_XTEXT(Workspace, MenuTitle, "Workspaces", "Title of main workspace menu")); | 113 | setLabel(_FB_XTEXT(Workspace, MenuTitle, "Workspaces", "Title of main workspace menu")); |
114 | insert(_FB_XTEXT(Menu, Icons, "Icons", "Iconic windows menu title"), | 114 | insertSubmenu(_FB_XTEXT(Menu, Icons, "Icons", "Iconic windows menu title"), |
115 | MenuCreator::createMenuType("iconmenu", screen.screenNumber())); | 115 | MenuCreator::createMenuType("iconmenu", screen.screenNumber())); |
116 | insert(new FbTk::MenuSeparator()); | 116 | insertItem(new FbTk::MenuSeparator()); |
117 | 117 | ||
118 | ::add_workspaces(*this, screen); | 118 | ::add_workspaces(*this, screen); |
119 | setItemSelected(screen.currentWorkspace()->workspaceID() + IDX_AFTER_ICONS, true); | 119 | setItemSelected(screen.currentWorkspace()->workspaceID() + IDX_AFTER_ICONS, true); |
@@ -134,12 +134,12 @@ void WorkspaceMenu::init(BScreen &screen) { | |||
134 | 134 | ||
135 | RefCount<Command<void> > start_edit(FbTk::CommandParser<void>::instance().parse("setworkspacenamedialog")); | 135 | RefCount<Command<void> > start_edit(FbTk::CommandParser<void>::instance().parse("setworkspacenamedialog")); |
136 | 136 | ||
137 | insert(new FbTk::MenuSeparator()); | 137 | insertItem(new FbTk::MenuSeparator()); |
138 | insert(_FB_XTEXT(Workspace, NewWorkspace, "New Workspace", "Add a new workspace"), | 138 | insertCommand(_FB_XTEXT(Workspace, NewWorkspace, "New Workspace", "Add a new workspace"), |
139 | new_workspace_cmd); | 139 | new_workspace_cmd); |
140 | insert(_FB_XTEXT(Toolbar, EditWkspcName, "Edit current workspace name", "Edit current workspace name"), | 140 | insertCommand(_FB_XTEXT(Toolbar, EditWkspcName, "Edit current workspace name", "Edit current workspace name"), |
141 | start_edit); | 141 | start_edit); |
142 | insert(_FB_XTEXT(Workspace, RemoveLast, "Remove Last", "Remove the last workspace"), | 142 | insertCommand(_FB_XTEXT(Workspace, RemoveLast, "Remove Last", "Remove the last workspace"), |
143 | remove_last_cmd); | 143 | remove_last_cmd); |
144 | 144 | ||
145 | updateMenu(); | 145 | updateMenu(); |