calling MainMenuAction() from an other plugin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux