[66] | 1 | //
|
---|
| 2 | // File: ICeCoffEEController.m
|
---|
| 3 | //
|
---|
| 4 | // Contains: ICeCoffEE APE APE preference pane controller
|
---|
| 5 | //
|
---|
| 6 | // Copyright: Copyright (c) 2003, Nicholas Riley
|
---|
| 7 | // All Rights Reserved.
|
---|
| 8 | //
|
---|
| 9 | // Author(s): Nicholas Riley (Sun Jan 19 2003)
|
---|
| 10 | //
|
---|
| 11 | // ===========================================================================
|
---|
| 12 |
|
---|
| 13 | #import <ApplicationEnhancer/ApplicationEnhancer.h>
|
---|
| 14 | #import "ICeCoffEEController.h"
|
---|
| 15 |
|
---|
| 16 | // Just a handy macro for localized strings from our bundle; unused in this project.
|
---|
| 17 | #define NSLocalizedString_(key, comment) [[self bundle] localizedStringForKey:(key) value:@"" table:nil]
|
---|
| 18 |
|
---|
| 19 | @implementation ICeCoffEEController
|
---|
| 20 |
|
---|
| 21 | // This method should return an id of a class that implements the protocol
|
---|
| 22 | // required by APE Manager.
|
---|
| 23 |
|
---|
| 24 | + (id)prefPaneHandlerForAPE:(NSBundle*)apeBundle andBundle:(NSBundle*)prefPaneBundle
|
---|
| 25 | {
|
---|
| 26 | return [[self alloc] initWithAPE:apeBundle andBundle:prefPaneBundle];
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | // Init the instance of our class
|
---|
| 30 | - (id)initWithAPE:(NSBundle*)apeBundle andBundle:(NSBundle*)prefPaneBundle
|
---|
| 31 | {
|
---|
| 32 | [self setBundle:prefPaneBundle]; // save our bundle for future use
|
---|
| 33 |
|
---|
| 34 | [NSBundle loadNibNamed:@"APE Manager plugin" owner:self]; // load our nib file; it will call our awakeFromNib method
|
---|
| 35 |
|
---|
| 36 | return self;
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | // This method is called when the preference pane is about to be shown.
|
---|
| 40 | - (void)willLoad
|
---|
| 41 | {
|
---|
| 42 | // we do nothing here
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | // This method is called when the preference pane will be dismissed.
|
---|
| 46 | - (void)willUnload
|
---|
| 47 | {
|
---|
| 48 | // we do nothing here, as well
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | // This method should return an NSView to be loaded into APE Manager preference
|
---|
| 52 | // area.
|
---|
| 53 | - (NSView*)mainView
|
---|
| 54 | {
|
---|
| 55 | return [window contentView]; // we return our window's contentView
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | // This method is called once our nib file is loaded (we load it in the init method)
|
---|
| 59 | - (void)awakeFromNib
|
---|
| 60 | {
|
---|
| 61 | prefs = [[CFPreferencesWrapper_ICeCoffEE preferencesWithApplication:@"net.sabi.ICeCoffEE"] retain];
|
---|
| 62 | // load the preferences for our APE module
|
---|
| 63 |
|
---|
| 64 | // do other inits here
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | // Utility getters/setters --
|
---|
| 68 |
|
---|
| 69 | -(void) setBundle:(NSBundle *)aBundle {
|
---|
| 70 | [aBundle retain];
|
---|
| 71 | [_bundle release];
|
---|
| 72 | _bundle = aBundle;
|
---|
| 73 | }
|
---|
| 74 |
|
---|
| 75 | -(NSBundle *) bundle {
|
---|
| 76 | [_bundle autorelease];
|
---|
| 77 | return [_bundle retain];
|
---|
| 78 | }
|
---|
| 79 | @end
|
---|