Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Using Cocoa...' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Using Cocoa...
Authored by: Anonymous on Mar 20, '01 09:30:19PM
This is what I just whipped up:
- (IBAction)test:(id)sender
{
 NSDictionary *finderPrefs = [[NSUserDefaults standardUserDefaults] persistentDomainForName:@"com.apple.finder"];
 NSMutableDictionary *finderDict = [finderPrefs mutableCopy];
 NSMutableDictionary *subDict = [[finderDict objectForKey:@"DesktopViewOptions"] mutableCopy];
    [subDict setObject:@"file://localhost/Users/( ... )/whatever.jpg" forKey:@"BackgroundPictureURL"];
    [finderDict setObject:subDict forKey:@"DesktopViewOptions"];
 [[NSUserDefaults standardUserDefaults] setPersistentDomain:[NSDictionary dictionaryWithDictionary:finderDict] forName:@"com.apple.finder"];
  [[NSUserDefaults standardUserDefaults] synchronize];
//find someway to notify the Finder that the defaults have changed
// ...
 [finderDict release];
 [subDict release];
}
The problem then is not how to change the value but how to tell the Finder to update the background.



[ Reply to This | # ]