• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: Binding to Desktop Image Path?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Binding to Desktop Image Path?


  • Subject: RE: Binding to Desktop Image Path?
  • From: "Christopher Hickman" <email@hidden>
  • Date: Fri, 12 May 2006 12:17:49 -0400

The more I look for an answer for this, the more I'm *not* finding any
indication that you can bind to any persistent domain beyond your own
application's.  Is this something NSUserDefaultsController can't do, or is
there some documentation I'm missing?  I want to bind to the value of a key
"ImageFilePath" in a dictionary which is the value of a key "default" in a
dictionary with key "Background" in the "com.apple.desktop" persistent
domain in user defaults.

Here's a visual...

UserDefaults
> (domain)com.apple.desktop
 > (dict)Background
  > (dict)default
   > (string)ImageFilePath

> -----Original Message-----
> From: cocoa-dev-bounces+tophu=email@hidden
> [mailto:cocoa-dev-bounces+tophu=email@hidden] On
> Behalf Of Christopher Hickman
> Sent: Tuesday, May 09, 2006 1:58 PM
> To: 'Cocoa Cocoa-Dev'
> Subject: Binding to Desktop Image Path?
>
> Can this code be replaced with a binding with
> NSUserDefaultsController?
>
> /* begin code snippet */
> NSUserDefaults *uDef = [NSUserDefaults standardUserDefaults];
> NSDictionary *uDefDict = [[[uDef
> persistentDomainForName:@"com.apple.desktop"]
> objectForKey:@"Background"]
> objectForKey:@"default"];
> NSString *imagePath = [uDefDict objectForKey:@"ImageFilePath"];
> /* end code snippet */
>
> I tried binding the value of an NSTextField in my nib to the
> NSUserDefaultsController, using:
>
> Bind to: Shared User Defaults
> Controller Key: values
> Model Key Path: com.apple.com.Background.default.ImageFilePath
>
> The NSTextField ends up nil.  I still don't fully understand
> the controller
> key and model key stuff for bindings, so I'm probably using
> it wrong.  How
> should I reference this?  I know I can't pull this string
> directly from the
> command line with defaults read, since I can't go deeper than
> the dictionary
> in the com.apple.desktop domain with the key Background.
>
> Topher
>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Binding to Desktop Image Path? (From: "Christopher Hickman" <email@hidden>)

  • Prev by Date: AuthorizationExecuteWithPrivileges retains file handles
  • Next by Date: Re: NSSpellServer problem (``Couldn\\\'t contact Spell Server\\\'\\\')
  • Previous by thread: Binding to Desktop Image Path?
  • Next by thread: Strange effect when rotating and scaling
  • Index(es):
    • Date
    • Thread