Hi Fabian,
I think that there is a mechanism explicitly designed to check if changes are saved. (You can find out by tracking what happens if there are unsaved changes in the account preferences.)
I do something simpler, though, to detect if the preference module is switched from. If you also want to handle the case when the whole window is closed (which I do not handle), removing the [[self window] isVisible] part should work.
So this is what I do: I have my settings displayed in a NSBox subclass that implements this method:
- (void) viewWillMoveToSuperview: (NSView*) newSuperview{
if( newSuperview == nil && [[self window] isVisible] ){
// do stuff
}
}
--
Adam