Author: bklaas
Date: Wed Apr  9 13:07:46 2008
New Revision: 2181

URL: http://svn.slimdevices.com?rev=2181&root=Jive&view=rev
Log:
Bug: 7734
Description: re-request home menu after language has been changed, but only 
when connected to a player
remove unnecessary parsing of global strings file in SetupLanguage, and let 
locale.lua do that.

Modified:
    
trunk/squeezeplay/src/squeezeplay/share/applets/SetupLanguage/SetupLanguageApplet.lua
    trunk/squeezeplay/src/squeezeplay/share/jive/utils/locale.lua

Modified: 
trunk/squeezeplay/src/squeezeplay/share/applets/SetupLanguage/SetupLanguageApplet.lua
URL: 
http://svn.slimdevices.com/trunk/squeezeplay/src/squeezeplay/share/applets/SetupLanguage/SetupLanguageApplet.lua?rev=2181&root=Jive&r1=2180&r2=2181&view=diff
==============================================================================
--- 
trunk/squeezeplay/src/squeezeplay/share/applets/SetupLanguage/SetupLanguageApplet.lua
 (original)
+++ 
trunk/squeezeplay/src/squeezeplay/share/applets/SetupLanguage/SetupLanguageApplet.lua
 Wed Apr  9 13:07:46 2008
@@ -22,6 +22,7 @@
 local oo               = require("loop.simple")
 
 local Applet           = require("jive.Applet")
+local AppletManager    = require("jive.AppletManager")
 local RadioGroup       = require("jive.ui.RadioGroup")
 local RadioButton      = require("jive.ui.RadioButton")
 local Framework        = require("jive.ui.Framework")
@@ -165,7 +166,6 @@
 
 function setLang(self, choice)
        log:info("Locale choice set to ", choice)
-       log:warn("YOU ARE HERE")
 
         local popup = Popup("popupIcon")
         popup:setAllowScreensaver(false)
@@ -189,15 +189,29 @@
        self:_showLang(choice)
        self:getSettings().locale = choice
 
-       -- fetch global strings table first and then send it to setLocale 
-       -- so it doesn't have to be refetched for every applet
-       local globalStrings = locale:readGlobalStringsFile()
-       locale:setLocale(choice, globalStrings)
+       -- if connected to a player, ask for the menu again
+       local player = _getCurrentPlayer(self)
+       if player then
+               local server = player:getSlimServer()
+               if server then
+                        server:request(nil, player:getId(), { 'menu', 0, 100 })
+               end
+       end
+
+       locale:setLocale(choice)
        jiveMain:jiveMainNodes()
        Framework:styleChanged()
        return true
 end
 
+function _getCurrentPlayer(self)
+       local manager = AppletManager:getAppletInstance("SlimDiscovery")
+
+       if manager and manager:getCurrentPlayer() then
+               return manager:getCurrentPlayer()
+       end
+       return false
+end
 
 --[[
 

Modified: trunk/squeezeplay/src/squeezeplay/share/jive/utils/locale.lua
URL: 
http://svn.slimdevices.com/trunk/squeezeplay/src/squeezeplay/share/jive/utils/locale.lua?rev=2181&root=Jive&r1=2180&r2=2181&view=diff
==============================================================================
--- trunk/squeezeplay/src/squeezeplay/share/jive/utils/locale.lua (original)
+++ trunk/squeezeplay/src/squeezeplay/share/jive/utils/locale.lua Wed Apr  9 
13:07:46 2008
@@ -47,19 +47,13 @@
 
 =cut
 --]]
-function setLocale(self, newLocale, myGlobalStrings)
+function setLocale(self, newLocale)
        if newLocale == globalLocale then
                return
        end
 
        globalLocale = newLocale or "EN"
-
-       -- globalStrings table was either passed to this method or we need to 
fetch it
-       if myGlobalStrings then
-               globalStrings = myGlobalStrings
-       else
-               readGlobalStringsFile(self)
-       end
+       readGlobalStringsFile(self)
 
        -- reload existing strings files
        for k, v in pairs(loadedFiles) do

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

Reply via email to