Re: CFPreferences
Re: CFPreferences
- Subject: Re: CFPreferences
- From: Alan Smith <email@hidden>
- Date: Sat, 28 Jan 2006 10:39:09 -0500
Oh, yeah. How would you save the preference back inside the two dictionarys?
Thanks, Alan
On 1/27/06, Rosyna <email@hidden> wrote:
>
> Because ImageFilePath isn't in the top of the preferences. It is
> inside a dictionary with some weird number (or default) which is
> inside a dictionary called "Background". You must go through both of
> those.
>
> NSDictionary*
> background=(NSDictionary*)CFPreferencesCopyAppValue(CFSTR("
> com.apple.desktop"),
> CFSTR("Background"));
>
> if (background and
> CFDictionaryGetTypeID()==CFGetTypeID((CFTypeRef)background))
> {
> NSDictionary* thingy=[background objectForKey:@"default"];
> if (thingy and CFDictionaryGetTypeID()==CFGetTypeID((CFTypeRef)thingy))
> {
> NSString* pathsAreEvilAndShouldNeverBeUsedForAnthing=[thingy
> objectForKey:@"ImageFilePath"];
> if (pathsAreEvilAndShouldNeverBeUsedForAnthing and
> CFDictionaryGetTypeID()==CFGetTypeID((CFTypeRef)
> pathsAreEvilAndShouldNeverBeUsedForAnthing))
> {
>
> // do whatever with the path or retain it for later.
> }
> }
> [background release]; //releases the path unless you explicitly
> retained the path above.
> }
>
> Ack, at 1/27/06, Alan Smith said:
>
> >NSString *myString;
> >
> >CFStringRef *appID = CFSTR("com.apple.desktop");
> >CFStringRef *key = CFSTR("ImageFilePath");
> >
> >myString = (NSString*)CFPreferencesCopyAppValue(appID, key);
> >
> >NSLog(myString);
> >
> >Now that looks simple enough but I can't get it to work. Now when I watch
> it
> >through the debugger the CF variables are set right and turn red (like
> >they're supossed to), then it gets to initializing myString and it turns
> red
> >but is set to nil.
> >Now if you were to look in your com.apple.desktop.plist file, you could
> >find, key, ImageFilePath, and its data would be something like,
> >"/Library/User Pictures/Aqua Blue.jpg". Contrary to what Uli said it's a
> >string. I looked in Property List Editor.app and it says the class for
> the
> >key is string, but the key above that is ImageFileAlias which is of type
> >alias.
> >So the question is, what's going on?
>
> --
>
>
> Sincerely,
> Rosyna Keller
> Technical Support/Holy Knight/Always needs a hug
>
> Unsanity: Unsane Tools for Insanely Great People
>
> It's either this, or imagining Phil Schiller in a thong.
>
_______________________________________________
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