aboutsummaryrefslogtreecommitdiff
path: root/src/FbCommands.cc
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2008-05-13 01:13:56 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-05-13 01:13:56 (GMT)
commit68cf3092208830e075c4fe5eddfdcbef3f11596a (patch)
treed0a8ed49f827286c2494968b0a336934912bff9e /src/FbCommands.cc
parentdcdc78332431ff2b258c54a99d6fac382c6a0595 (diff)
downloadfluxbox_pavel-68cf3092208830e075c4fe5eddfdcbef3f11596a.zip
fluxbox_pavel-68cf3092208830e075c4fe5eddfdcbef3f11596a.tar.bz2
implement smarter reloading for custom menus
Diffstat (limited to 'src/FbCommands.cc')
-rw-r--r--src/FbCommands.cc17
1 files changed, 12 insertions, 5 deletions
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() {