Changes to better display Desktop Picture over loginwindow on more OS versions and if /Library/Preferences/com.apple.loginwindow DesktopPicture points to a non-existant picture.

Added Solid Aqua Blue.png as a resource for use as a DesktopPicture of last resort.

git-svn-id: http://munki.googlecode.com/svn/trunk@103 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
Greg Neagle
2009-06-24 04:47:04 +00:00
parent d229889c65
commit 7bec452b3e
3 changed files with 29 additions and 9 deletions
+24 -8
View File
@@ -44,16 +44,32 @@ on awake from nib theObject
copy (call method "mainScreenRect") to screenRect
call method "setFrame:display:" of theObject with parameters {screenRect, true}
try
tell application "System Events"
set DesktopPicture to value of property list item "DesktopPicture" of property list file "/Library/Preferences/com.apple.loginwindow.plist"
if exists (POSIX file DesktopPicture as file) then
--do nothing; just trying to trigger an error
end if
end tell
--tell application "System Events"
--set DesktopPicture to value of property list item "DesktopPicture" of property list file "/Library/Preferences/com.apple.loginwindow.plist"
--end tell
set DesktopPicture to do shell script "/usr/bin/defaults read /Library/Preferences/com.apple.loginwindow DesktopPicture"
on error
set DesktopPicture to "/Library/Desktop Pictures/Aqua Blue.jpg"
-- no DesktopPicture set for loginwindow, let's use some defaults
try
set DesktopPicture to "/System/Library/CoreServices/DefaultDesktop.jpg"
tell application "System Events"
if exists (POSIX file DesktopPicture as file) then
--do nothing; just trying to trigger an error
end if
end tell
on error
set DesktopPicture to "/Library/Desktop Pictures/Aqua Blue.jpg"
end try
end try
-- now we have a DesktopPicture, try to load the image
try
do shell script "/usr/bin/logger -t MunkiStatus 'Setting background to " & DesktopPicture
set bgPicture to load image DesktopPicture
on error
-- failed. just use our internal solid blue background
do shell script "/usr/bin/logger -t MunkiStatus 'Setting background to Solid Aqua Blue'"
set bgPicture to load image "Solid Aqua Blue"
end try
set bgPicture to load image DesktopPicture
set contents of image view "imageFld" of theObject to bgPicture
show theObject
end if