shpakovski/MASPreferences — pull request #4 by sorbits (2011-10-10 19:34:11+00:00)
Title: Refactoring + various changes

I’ve tried to maintain your style but did several changes, see individual commit messages.

The animation parameter is ignored but since it is part of the public API I haven’t removed it (though would like to).

I dropped the old “commit” stuff (which changed first responder) instead we should rely on the `NSEditorRegistration` protocol for the `NSViewController` and key/value validation.

The `setSelectedViewController:` is a little large now, but I think all the stuff it does should always be done when changing the selected view, and by having it all in one place it is simpler to follow the flow and also ensure everything that should be done, gets done (i.e. updating toolbar selection, sending notifications, etc.).

Btw: What is the purpose of the view controller callbacks for `viewWillAppear`/`viewDidDisappear`? These seems a little non-standard, i.e. not symmetric (no `viewDidAppear` or `viewWillDisappear`) and does not receive a “sender” argument (which should be the preferences (window) controller). Though I’d recommend getting rid of them unless there is a good case for keeping them — if the user badly need to be informed about views appearing, there already are `viewWillMoveToWindow:`/`viewDidMoveToWindow`. Sort of same argument for ditching `kMASPreferencesWindowControllerDidChangeViewNotification`.