diff options
Diffstat (limited to 'src/FbCommands.cc')
-rw-r--r-- | src/FbCommands.cc | 17 |
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 | ||
357 | void ShowCustomMenuCmd::reload() { | ||
358 | m_menu->removeAll(); | ||
359 | m_menu->setLabel(""); | ||
360 | MenuCreator::createFromFile(custom_menu_file, *m_menu.get(), m_menu->reloadHelper()); | ||
361 | } | ||
362 | |||
356 | REGISTER_COMMAND(rootmenu, FbCommands::ShowRootMenuCmd, void); | 363 | REGISTER_COMMAND(rootmenu, FbCommands::ShowRootMenuCmd, void); |
357 | 364 | ||
358 | void ShowRootMenuCmd::execute() { | 365 | void ShowRootMenuCmd::execute() { |