Ok,
thank you to eskimo1 on the Apple Developer Forum I get how to setup a
notification for changes on prefs.
Something like:
- (void)prefsDidChange
{
// reread your view of the world
}
static void PrefsDidChange(
SCPreferencesRef prefs,
SCPreferencesNotification notificationType,
void * info
)
{
MyClass * obj;
assert(prefs != NULL);
if (notificationType & kSCPreferencesNotificationApply) {
obj = (MyClass *) info;
assert([obj isKindOfClass:[MyClass class]]);
[obj prefsDidChange];
}
}
- (void)someMethod
{
SCPreferencesRef prefs;
Boolean success;
SCPreferencesContext context = { 0, self, NULL, NULL, NULL };
prefs = SCPreferencesCreate(NULL, CFSTR("MyAppName"), NULL);
assert(prefs != NULL);
success = SCPreferencesSetCallback(prefs, PrefsDidChange, &context);
assert(success);
success = SCPreferencesScheduleWithRunLoop(
prefs,
CFRunLoopGetCurrent(),
kCFRunLoopDefaultMode
);
assert(success);
}
but every time prefDidChange is called when I try to get the CurrentSet from
kSCPrefCurrentSet as:
CFPropertyListRef current = SCPreferencesGetValue(prefs, kSCPrefCurrentSet);
it still returns me the previous one, like nothing is really changed, even if
in the Console I can read:
CurrentSet updated to BE5263F0-0FED-4B6E-9786-E58E51F5CD1E (Automatic)
Have you any idea?
Thank you!
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]