Author: bklaas
Date: Wed Feb 20 07:48:18 2008
New Revision: 1986
URL: http://svn.slimdevices.com?rev=1986&root=Jive&view=rev
Log:
Bug: 7188
Description:
add help text for wallpaper settings menu, including when no player is selected
refactor applet to not break encapsulation
Modified:
trunk/jive/src/pkg/jive/share/applets/SetupWallpaper/SetupWallpaperApplet.lua
trunk/jive/src/pkg/jive/share/applets/SetupWallpaper/strings.txt
Modified:
trunk/jive/src/pkg/jive/share/applets/SetupWallpaper/SetupWallpaperApplet.lua
URL:
http://svn.slimdevices.com/trunk/jive/src/pkg/jive/share/applets/SetupWallpaper/SetupWallpaperApplet.lua?rev=1986&root=Jive&r1=1985&r2=1986&view=diff
==============================================================================
---
trunk/jive/src/pkg/jive/share/applets/SetupWallpaper/SetupWallpaperApplet.lua
(original)
+++
trunk/jive/src/pkg/jive/share/applets/SetupWallpaper/SetupWallpaperApplet.lua
Wed Feb 20 07:48:18 2008
@@ -92,15 +92,29 @@
function settingsShow(self)
local window = Window("window", self:string('WALLPAPER'),
'settingstitle')
+
+ self.currentPlayer = _getCurrentPlayer()
+ self.currentPlayerId = 'wallpaper'
+
+ local _currentPlayer = self.currentPlayer
+ local _playerId = self.currentPlayerid
+ local _playerName = false
+
+ if _currentPlayer then
+ _playerId = _currentPlayer:getId()
+ _playerName = _currentPlayer:getName()
+ end
+
+ if _playerName then
+ window:addWidget(Textarea("help",
self:string("WALLPAPER_HELP_PLAYER", _playerName)))
+ else
+ window:addWidget(Textarea("help",
self:string("WALLPAPER_HELP_NO_PLAYER")))
+ end
+
self.menu = SimpleMenu("menu")
window:addWidget(self.menu)
- self.currentPlayer = _getCurrentPlayer()
-
- local wallpaper = self:getSettings()[self.currentPlayer]
- if not wallpaper then
- wallpaper = self:getSettings()["wallpaper"]
- end
+ local wallpaper = self:getSettings()[_playerId]
self.server = self:_getCurrentServer()
self.group = RadioGroup()
@@ -116,12 +130,12 @@
icon = RadioButton("radio",
self.group,
function()
-
self:_setBackground(file, self.currentPlayer)
+
self:_setBackground(file, _playerId)
end,
wallpaper ==
file
),
focusGained = function(event)
-
self:_showBackground(file, self.currentPlayer)
+
self:_showBackground(file, _playerId)
end
})
@@ -152,7 +166,7 @@
-- Store the applet settings when the window is closed
window:addListener(EVENT_WINDOW_POP,
function()
- self:_showBackground(nil, self.currentPlayer)
+ self:_showBackground(nil, _playerId)
self:storeSettings()
end
)
@@ -164,15 +178,11 @@
function _getCurrentPlayer(self)
local manager = AppletManager:getAppletInstance("SlimDiscovery")
- -- defaults to 'wallpaper' for backward compatibility to when wallpaper
selection was not player-specific
- local currentPlayer = 'wallpaper'
- if manager then
- local currentPlayerObj = manager:getCurrentPlayer()
- if currentPlayerObj and currentPlayerObj.id then
- currentPlayer = currentPlayerObj.id
- end
- end
- return currentPlayer
+
+ if manager and manager:getCurrentPlayer() then
+ return manager:getCurrentPlayer()
+ end
+ return false
end
@@ -210,7 +220,7 @@
local path = Framework:findFile(PREFIX) .. entry.file
local attr = lfs.attributes(path)
if attr then
-
self:_setBackground(entry.file, self.currentPlayer)
+
self:_setBackground(entry.file, self.currentPlayerId)
end
end
),
@@ -219,7 +229,7 @@
local
attr = lfs.attributes(path)
if
attr and os.time() - attr.modification < REFRESH_TIME then
log:info("using local copy of: ", entry.file)
-
self:_showBackground(entry.file, self.currentPlayer)
+
self:_showBackground(entry.file, self.currentPlayerId)
else
log:info("fetching: ", entry.file)
local url
@@ -228,7 +238,7 @@
else
url = entry.url
end
-
self:_fetchFile(url, path, function() self:_showBackground(entry.file,
self.currentPlayer) end)
+
self:_fetchFile(url, path, function() self:_showBackground(entry.file,
self.currentPlayerId) end)
end
end
}
@@ -256,7 +266,7 @@
window:addWidget(Textarea("textarea", text))
self:tieAndShowWindow(window)
end,
- focusGained = function(event) self:_showBackground(nil,
self.currentPlayer) end
+ focusGained = function(event) self:_showBackground(nil,
self.currentPlayerId) end
}
end
Modified: trunk/jive/src/pkg/jive/share/applets/SetupWallpaper/strings.txt
URL:
http://svn.slimdevices.com/trunk/jive/src/pkg/jive/share/applets/SetupWallpaper/strings.txt?rev=1986&root=Jive&r1=1985&r2=1986&view=diff
==============================================================================
--- trunk/jive/src/pkg/jive/share/applets/SetupWallpaper/strings.txt (original)
+++ trunk/jive/src/pkg/jive/share/applets/SetupWallpaper/strings.txt Wed Feb 20
07:48:18 2008
@@ -10,6 +10,12 @@
FR Arrière-plan
IT Sfondo
NL Achtergrond
+
+WALLPAPER_HELP_PLAYER
+ EN Choose the screen background to be shown for %s
+
+WALLPAPER_HELP_NO_PLAYER
+ EN Choose the default screen background to be shown
CREDITS
DA Krediteringer
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins