Re: location of user-defaults
Re: location of user-defaults
- Subject: Re: location of user-defaults
- From: David Thorup <email@hidden>
- Date: Mon, 16 Jun 2003 21:13:44 -0600
On Monday, June 16, 2003, at 05:36 PM, Rhon Fitzwater wrote:
So if I use CFPreferences it will only store one copy of the
preference where? Or will every user that runs my app get their own
preference. What I want is a system wide preference, not a
user-specific preference. I want the admin of the computer to be able
to change the preferences, but the normal user should not be able to.
Can this be done with CFPreferences?
Yes, you should be able to do this with CFPreferences, though I haven't
done it yet myself. Take a look at the tables on this page:
http://developer.apple.com/techpubs/macosx/CoreFoundation/
ProgrammingTopics/CFPreferences/Concepts/PreferenceDomains.html
Specifically, you'd probably use these functions:
CFPreferencesCopyValue & CFPreferencesSetValue
Here's some sample code (caution, typed in Mail, use at your own risk):
CFStringRef defaultTextColorKey = CFSTR("defaultTextColor");
CFStringRef colorBLUE = CFSTR("BLUE");
// Set up the preference.
// I believe this would store it in /Library/Preferences
CFPreferencesSetValue(defaultTextColorKey,
colorBLUE,
kCFPreferencesCurrentApplication,
kCFPreferencesAnyUser,
kCFPreferencesCurrentHost);
Read through the CFPreferences documentation, it should show you how to
do what you need.
_____________________________
Dave Thorup
Software Engineer
email@hidden
http://www.kuwan.net
Defaults Manager - The premier editor for Mac OS X's User Defaults /
Preferences database.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.