On Jun 2, 2009, at 12:02 AM, Andy Lee wrote:
Dunno if this would work, but... how about doing setAutosavesConfiguration:YES and observing user defaults?

Whoops, just noticed this:

On Jun 1, 2009, at 11:06 PM, David Reitter wrote:
[Also we don't use the NS defaults system due to cross-platform maintenance requirements, so we need to implement persistency, even though this doesn't have to be synchronously of course.]

That's unfortunate, because this seems to work:

In awakeFromNib:

    NSString *defaultsKeyPathForToolbarItems =
[NSString stringWithFormat:@"NSToolbar Configuration %[email protected] Item Identifiers",
            [myToolbar identifier]];
    [[[NSUserDefaultsController sharedUserDefaultsController] defaults]
        addObserver:self
        forKeyPath:defaultsKeyPathForToolbarItems
        options:0
        context:NULL];

Then:

- (void) observeValueForKeyPath: (NSString *) keyPath
                       ofObject: (id) object
                         change: (NSDictionary *) change
                        context: (void *) context
{
NSLog(@"toolbar items are now %@", [[myToolbar items] valueForKey:@"itemIdentifier"]);
}


Maybe there's some way you can use the NSUserDefaults mechanism just for this, and ignore its persistence?

--Andy

_______________________________________________

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]

Reply via email to