aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--src/FbCommands.cc17
-rw-r--r--src/FbCommands.hh3
3 files changed, 17 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 89a93d6..80147cb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
1 (Format: Year/Month/Day) 1 (Format: Year/Month/Day)
2Changes for 1.1 2Changes for 1.1
3*08/05/13:
4 * Only reload custom menus when necessary (Mark)
5 FbCommands.cc/hh
3*08/05/12: 6*08/05/12:
4 * Only reload the keys file if the contents have changed (Mark) 7 * Only reload the keys file if the contents have changed (Mark)
5 Keys.cc/hh fluxbox.cc/hh 8 Keys.cc/hh fluxbox.cc/hh
diff --git a/src/FbCommands.cc b/src/FbCommands.cc
index 3a09b69..e0d0768 100644
--- a/src/FbCommands.cc
+++ b/src/FbCommands.cc
@@ -343,16 +343,23 @@ void ShowCustomMenuCmd::execute() {
343 if (screen == 0) 343 if (screen == 0)
344 return; 344 return;
345 345
346 if (m_menu.get()) { 346 if (!m_menu.get() || screen->screenNumber() != m_menu->screenNumber()) {
347 m_menu->removeAll();
348 m_menu->setLabel("");
349 } else
350 m_menu.reset(screen->createMenu("")); 347 m_menu.reset(screen->createMenu(""));
348 m_menu->setReloadHelper(new FbTk::AutoReloadHelper());
349 m_menu->reloadHelper()->setReloadCmd(FbTk::RefCount<FbTk::Command<void> >(new FbTk::SimpleCommand<ShowCustomMenuCmd>(*this, &ShowCustomMenuCmd::reload)));
350 m_menu->reloadHelper()->setMainFile(custom_menu_file);
351 } else
352 m_menu->reloadHelper()->checkReload();
351 353
352 MenuCreator::createFromFile(custom_menu_file, *m_menu.get());
353 ::showMenu(*screen, *m_menu.get()); 354 ::showMenu(*screen, *m_menu.get());
354} 355}
355 356
357void ShowCustomMenuCmd::reload() {
358 m_menu->removeAll();
359 m_menu->setLabel("");
360 MenuCreator::createFromFile(custom_menu_file, *m_menu.get(), m_menu->reloadHelper());
361}
362
356REGISTER_COMMAND(rootmenu, FbCommands::ShowRootMenuCmd, void); 363REGISTER_COMMAND(rootmenu, FbCommands::ShowRootMenuCmd, void);
357 364
358void ShowRootMenuCmd::execute() { 365void ShowRootMenuCmd::execute() {
diff --git a/src/FbCommands.hh b/src/FbCommands.hh
index 3ad45c4..811fb78 100644
--- a/src/FbCommands.hh
+++ b/src/FbCommands.hh
@@ -132,9 +132,10 @@ class ShowCustomMenuCmd: public FbTk::Command<void> {
132public: 132public:
133 explicit ShowCustomMenuCmd(const std::string &arguments); 133 explicit ShowCustomMenuCmd(const std::string &arguments);
134 void execute(); 134 void execute();
135 void reload();
135private: 136private:
136 std::string custom_menu_file; 137 std::string custom_menu_file;
137 std::auto_ptr<FbTk::Menu> m_menu; 138 std::auto_ptr<FbMenu> m_menu;
138}; 139};
139 140
140class ShowRootMenuCmd: public FbTk::Command<void> { 141class ShowRootMenuCmd: public FbTk::Command<void> {