Re: Changing Desktop picture from Cocoa app in 10.1 without re-starting Finder [Success!]
Re: Changing Desktop picture from Cocoa app in 10.1 without re-starting Finder [Success!]
- Subject: Re: Changing Desktop picture from Cocoa app in 10.1 without re-starting Finder [Success!]
- From: Matthew Formica <email@hidden>
- Date: Fri, 26 Oct 2001 12:55:18 -0700
If I am not mistaken, I think the correct public way to do this in 10.1 is
to send the right AppleEvent to the Finder. Although, I don't know off the
top of my head what the right one is.
- Matthew
on 10/26/01 10:24 AM, Mark Orchard at email@hidden remarked:
>
Thanks to all who replied.
>
>
I managed to get com.apple.desktop.plist into an NSMutableDictionary, write
>
a property for the correct key and write the dict. back to file.
>
>
Jonathan's distributed notification was the key. The desktop picture changed
>
without re-starting the Finder. Strangely enough, although the picture
>
changed, the Desktop Pref. Pane doesn't update (in 10.1), so I guess it
>
doesn't subscribe to the "com.apple.desktop" notif. with the
>
"BackgroundChanged" message/data.
>
>
Speaking of these particular messages, are they publicly documented
>
anywhere? This one was a real nugget. Maybe you have to be a paid up member
>
of the Developer Program to see these things ;-)
>
>
Anyway, I'm very happy at the moment although I know this is going to break
>
in some future OS revision. Writing directly to plists is too low-level.
>
I'll only feel comfortable about non-breakage of my app. if Apple supply a
>
higher level API for writing User property lists in some AppKit somewhere.
>
>
I wonder what Apple's official position is on application's writing directly
>
to property lists?
>
I'd assume that it would be totally unsupported but I also get the
>
impression that a lot of developers are doing it!
>
>
Thanks again,
>
>
Mark Orchard
>
IT Network Specialist
>
IPMS Application Manager/Developer
>
iTech
>
(03)9634 7465
>
email@hidden, email@hidden
>
>
-----Original Message-----
>
From: Jonathan Hendry [mailto:email@hidden]
>
Sent: Friday, 26 October 2001 8:09 AM
>
To: Mark Orchard
>
Cc: email@hidden; email@hidden
>
Subject: Re: Changing Desktop picture from Cocoa app in 10.1 without
>
re-starting Finder [Again]
>
>
>
>
Use this, after you change the desktop image specified in
>
the defaults database:
>
>
[[NSDistributedNotificationCenter defaultCenter]
>
postNotificationName:@"com.apple.desktop"
>
object:@"BackgroundChanged"];
>
_______________________________________________
>
cocoa-dev mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev