• 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: location of user-defaults
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.
  • Prev by Date: Re: Rendezvous & StartupItems
  • Next by Date: Re: NSUnarchiver unarchiveObjectWithData problem
  • Previous by thread: Re: location of user-defaults
  • Next by thread: Cocoa-Java delegate name?
  • Index(es):
    • Date
    • Thread