[vdr] calling MainMenuAction() from an other plugin

Udo Richter udo_richter at gmx.de
Wed Mar 29 00:04:30 CEST 2006


Klaus Schmidinger wrote:
> Am I missing something here?

This is mostly about plugins that expect their MainMenuAction to be 
called. A plugin may catch this call and display a message instead of 
the default menu. If the call is canceled, the message will unexpectedly 
appear the next time the user selects the main menu item.
(As I said before, I would suggest signaling and timeouts anyway)

Things might get useful with another patch I wouldn't dare to suggest 
before 1.4 ;)

This is current code:

    DELETE_MENU;
    if (cControl::Control())
       cControl::Control()->Hide();
    cPlugin *plugin = cPluginManager::GetPlugin(cRemote::GetPlugin());
    if (plugin) {
       Menu = plugin->MainMenuAction();
       if (Menu)
          Menu->Show();
       }

This is my idea:

    cPlugin *plugin = cPluginManager::GetPlugin(cRemote::GetPlugin());
    if (plugin) {
       cMenu *NewMenu = plugin->MainMenuAction();
       if (NewMenu) {
          DELETE_MENU;
          if (cControl::Control())
             cControl::Control()->Hide();
          Menu = NewMenu;
          Menu->Show();
          }
       }

That way, the old OSD/menu will be destroyed only if MainMenuAction 
returned a new menu. If MainMenuAction returns NULL, nothing should 
happen. This would be a nice dirty trick to catch the main thread from a 
plugin.
I don't know whether that change has bad side effects though.

Cheers,

Udo




More information about the vdr mailing list