Re: SCPreferences for private use
Re: SCPreferences for private use
- Subject: Re: SCPreferences for private use
- From: Allan Nathanson <email@hidden>
- Date: Tue, 10 Feb 2004 09:42:13 -0500
On Feb 8, 2004, at 4:09 PM, Ryan McGann wrote:
Sorry if this is the wrong list, but I wasn't sure where else this
could be posted.
I was looking at the SCPreferences APIs in System Configuration, and
thought they would be nice to use in our program. We have several
processes that need to have write access to our preferences data, and
SCPreferences seems to provide some of the APIs we would need like
locking. Is SCPreferences recommended for 3rd party use, or is it
strictly for storing system preferences information?
The SCPreferences APIs are most certainly supported. Whether they are
appropriate for 3rd party use would depend on the requirements of your
applications. In any case, here are a few things to note about these
APIs.
On the plus side:
- the APIs include a simply locking scheme which you can use to ensure
one application has a consistent view of the current preferences before
any changes are made.
- the APIs include a simple notification mechanism (although not via a
public/supported API).
On the minus side:
- any application / tool wishing to write to the preferences must be
running as "root" (uid==0). This one restriction would, IMHO, make it
unsuitable for more end-user applications.
If it is OK to use SCPreferences for managing our preferences, is it
possible to receive notifications when our preferences managed with
SCPreferences have changed, like you can with the dynamic store APIs?
Looking at the source to the SCPreferences APIs, it does look like
some notifications are posted for commit, but I don't see any (public)
way of determining the key to pass to the dynamic store APIs to watch
for those notifications.
As you've noted from the sources, the current implementation of the
SCPreferences API layer on top of dynamic store APIs for locking and
notification. You are also correct that there is no (public) way of
determining the set of dynamic store keys which are used for locking
and notification for any given "prefsID". Establishing a public API
for monitoring preference changes is on my "to do" list. Whether these
APIs are based on the current implementation or some new scheme is
still TBD.
- Allan
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.