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/ClockTool.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/ClockTool.cc')
-rw-r--r-- | src/ClockTool.cc | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/ClockTool.cc b/src/ClockTool.cc index f2a7333..893d32b 100644 --- a/src/ClockTool.cc +++ b/src/ClockTool.cc | |||
@@ -37,11 +37,7 @@ | |||
37 | #include "FbTk/I18n.hh" | 37 | #include "FbTk/I18n.hh" |
38 | #include "FbTk/FbTime.hh" | 38 | #include "FbTk/FbTime.hh" |
39 | 39 | ||
40 | #ifdef HAVE_CTIME | 40 | #include <ctime> |
41 | #include <ctime> | ||
42 | #else | ||
43 | #include <time.h> | ||
44 | #endif | ||
45 | #include <typeinfo> | 41 | #include <typeinfo> |
46 | #include <cstdio> | 42 | #include <cstdio> |
47 | 43 | ||
@@ -171,9 +167,9 @@ ClockTool::ClockTool(const FbTk::FbWindow &parent, | |||
171 | FbTk::RefCount<FbTk::Command<void> > saverc(FbTk::CommandParser<void>::instance().parse("saverc")); | 167 | FbTk::RefCount<FbTk::Command<void> > saverc(FbTk::CommandParser<void>::instance().parse("saverc")); |
172 | FbTk::MenuItem *item = new ClockMenuItem(*this); | 168 | FbTk::MenuItem *item = new ClockMenuItem(*this); |
173 | item->setCommand(saverc); | 169 | item->setCommand(saverc); |
174 | menu.insert(item); | 170 | menu.insertItem(item); |
175 | FbTk::RefCount<FbTk::Command<void> > editformat_cmd(new EditClockFormatCmd()); | 171 | FbTk::RefCount<FbTk::Command<void> > editformat_cmd(new EditClockFormatCmd()); |
176 | menu.insert(_FB_XTEXT(Toolbar, ClockEditFormat, "Edit Clock Format", "edit Clock Format") , editformat_cmd); | 172 | menu.insertCommand(_FB_XTEXT(Toolbar, ClockEditFormat, "Edit Clock Format", "edit Clock Format") , editformat_cmd); |
177 | 173 | ||
178 | updateTime(); | 174 | updateTime(); |
179 | } | 175 | } |