Author: bklaas
Date: Fri Sep 12 09:54:00 2008
New Revision: 2914

URL: http://svn.slimdevices.com?rev=2914&root=Jive&view=rev
Log:
Bug: 9345
Description: create a 'removed' node managed by HomeMenu code that dumps items 
that have been removed
By doing this, it will not GC and allow apps like ChooseMusicSourceMeta to 
continue to subscribe to jnt events

Modified:
    
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/ChooseMusicSource/ChooseMusicSourceMeta.lua
    7.3/trunk/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua
    7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/HomeMenu.lua

Modified: 
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/ChooseMusicSource/ChooseMusicSourceMeta.lua
URL: 
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/share/applets/ChooseMusicSource/ChooseMusicSourceMeta.lua?rev=2914&root=Jive&r1=2913&r2=2914&view=diff
==============================================================================
--- 
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/ChooseMusicSource/ChooseMusicSourceMeta.lua
 (original)
+++ 
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/ChooseMusicSource/ChooseMusicSourceMeta.lua
 Fri Sep 12 09:54:00 2008
@@ -19,21 +19,12 @@
 local oo            = require("loop.simple")
 
 local AppletMeta    = require("jive.AppletMeta")
+local log           = require("jive.utils.log").logger("applets.setup")
 
 local appletManager = appletManager
 local jiveMain      = jiveMain
 local jnt           = jnt
 local _player       = false
-
-local menuItem      =  { 
-                               id       = 'appletSlimservers', 
-                               node     = 'settings', 
-                               text     = self:string("SLIMSERVER_SERVERS"), 
-                               callback = function(applet, ...) 
-                                               applet:settingsShow(...) 
-                                       end, 
-                               weight   = 60 
-                       }
 
 module(...)
 oo.class(_M, AppletMeta)
@@ -58,7 +49,17 @@
        -- set the poll list for discovery of slimservers based on our settings
        if appletManager:hasService("setPollList") then
                appletManager:callService("setPollList", 
meta:getSettings().poll)
-               jiveMain:addItem(menuItem)
+               jiveMain:addItem(
+                       meta:menuItem(
+                               'appletSlimservers', 
+                               'settings', 
+                               "SLIMSERVER_SERVERS", 
+                               function(applet, ...) 
+                                       applet:settingsShow(...) 
+                               end, 
+                               60
+                       )
+               )
 
        end
 
@@ -66,11 +67,21 @@
 
 end
 
-function notify_playerCurrent(self, player)
+function notify_playerCurrent(meta, player)
        if player == nil then
                jiveMain:removeItemById('appletSlimservers')
        else
-               jiveMain:addItem(menuItem)
+               jiveMain:addItem(
+                       meta:menuItem(
+                               'appletSlimservers', 
+                               'settings', 
+                               "SLIMSERVER_SERVERS", 
+                               function(applet, ...) 
+                                       applet:settingsShow(...) 
+                               end, 
+                               60
+                       )
+               )
        end
        _player = player
 end

Modified: 7.3/trunk/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua
URL: 
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua?rev=2914&root=Jive&r1=2913&r2=2914&view=diff
==============================================================================
--- 7.3/trunk/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua (original)
+++ 7.3/trunk/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua Fri Sep 12 
09:54:00 2008
@@ -225,6 +225,7 @@
        end
 
        jiveMain:addNode( { id = 'hidden', node = 'nowhere' } )
+       jiveMain:addNode( { id = 'removed', node = 'nowhere' } )
        jiveMain:addNode( { id = 'extras', node = 'home', text = 
_globalStrings:str("EXTRAS"), weight = 50  } )
        jiveMain:addNode( { id = 'games', node = 'extras', text = 
_globalStrings:str("GAMES"), weight = 70  } )
        jiveMain:addNode( { id = 'settings', node = 'home', noCustom = 1, text 
= _globalStrings:str("SETTINGS"), weight = 70, titleStyle = 'settings' })

Modified: 7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/HomeMenu.lua
URL: 
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/HomeMenu.lua?rev=2914&root=Jive&r1=2913&r2=2914&view=diff
==============================================================================
--- 7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/HomeMenu.lua (original)
+++ 7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/HomeMenu.lua Fri Sep 12 
09:54:00 2008
@@ -158,13 +158,15 @@
                -- change menuitem's node
                self.menuTable[id].node = node
                -- add item to that node
-               addNode(self.menuTable[id])
+               self:addNode(self.menuTable[id])
        end
 end
 
 function addNode(self, item)
-       assert(item.id)
-       assert(item.node)
+
+       if not item or not item.id or not item.node then
+               return
+       end
 
        log:debug("JiveMain.addNode: Adding a non-root node, ", item.id)
 
@@ -361,6 +363,13 @@
        end
 
        self:removeItemFromNode(item)
+
+       -- add this item to 'removed' node
+       -- this will allow an item to be removed without garbage collection 
+       -- killing the ability of some applet's meta files to get notification 
events
+       item.node = 'removed'
+       self:addItem(item)
+
        -- if this item is co-located in home, get rid of it there too
        self:removeItemFromNode(item, 'home')
 

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

Reply via email to