Author: bklaas
Date: Mon Jun 30 09:00:57 2008
New Revision: 2640

URL: http://svn.slimdevices.com?rev=2640&root=Jive&view=rev
Log:
Bug: 8539
Description: correctly hide/unhide NetTest item using playerCurrent notification

Modified:
    
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/SetupNetTestMeta.lua

Modified: 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/SetupNetTestMeta.lua
URL: 
http://svn.slimdevices.com/7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/SetupNetTestMeta.lua?rev=2640&root=Jive&r1=2639&r2=2640&view=diff
==============================================================================
--- 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/SetupNetTestMeta.lua
 (original)
+++ 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/SetupNetTestMeta.lua
 Mon Jun 30 09:00:57 2008
@@ -7,6 +7,8 @@
 
 
 local oo            = require("loop.simple")
+
+local log           = require("jive.utils.log").logger("applets.misc")
 
 local AppletMeta    = require("jive.AppletMeta")
 
@@ -27,18 +29,28 @@
 function registerApplet(meta)
        jnt:subscribe(meta)
 
-       meta.menu = meta:menuItem('appletSetupNetTest', 'advancedSettings', 
meta:string('SETUPNETTEST'), function(applet, ...) applet:open(...) end, 100)
-               jiveMain:addItem(meta.menu)
+       meta.menu = meta:menuItem('appletSetupNetTest', 'hidden', 
meta:string('SETUPNETTEST'), function(applet, ...) applet:open(...) end, 100)
+       -- add the menu item to homeMenu but 'hidden', or else the 
playerCurrent notification method below quits happening (not sure why this is 
the case, but it is)
+       -- item will be made visible by moving it to advancedSettings in the 
playerCurrent notification below
+       jiveMain:addItem(meta.menu)
 
        jiveMain:loadSkin("SetupNetTest", "skin")
 end
 
+-- hide menu item when player goes away
+function notify_playerDelete(meta, player)
+       jiveMain:setNode(meta.menu, 'hidden')
+end
 
 function notify_playerCurrent(meta, player)
-       if player == nil or ( player:getSlimServer() and 
player:getSlimServer():isSqueezeNetwork() ) then
-               jiveMain:removeItem(meta.menu)
+       -- don't show this item if the player object: 
+       --   a. doesn't exist
+       --   b. isn't connected to a server (now possible)
+       --   c. connected to SN
+       if player == nil or not player:getSlimServer() or ( 
player:getSlimServer() and player:getSlimServer():isSqueezeNetwork() ) then
+               jiveMain:setNode(meta.menu, 'hidden')
        else
-               jiveMain:addItem(meta.menu)
+               jiveMain:setNode(meta.menu, 'home')
        end
 end
 

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins

Reply via email to