1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
/* Example for use of GNU gettext.
This file is in the public domain.
Source code of the AppController class. */
#include "AppController.h"
#include "Hello.h"
@implementation AppController
static NSDictionary *infoDict = nil;
+ (void)initialize
{
NSMutableDictionary *defaults = [NSMutableDictionary dictionary];
[[NSUserDefaults standardUserDefaults] registerDefaults: defaults];
[[NSUserDefaults standardUserDefaults] synchronize];
}
- (id)init
{
self = [super init];
return self;
}
- (void)dealloc
{
if (hello)
RELEASE (hello);
[super dealloc];
}
- (void)awakeFromNib
{
}
- (void)applicationDidFinishLaunching:(NSNotification *)notif
{
}
- (BOOL)applicationShouldTerminate:(id)sender
{
return YES;
}
- (void)applicationWillTerminate:(NSNotification *)notification
{
}
- (BOOL)application:(NSApplication *)application openFile:(NSString *)fileName
{
}
- (void)showPrefPanel:(id)sender
{
}
- (void)showInfoPanel:(id)sender
{
if (!infoDict)
{
NSString *fp;
NSBundle *bundle = [NSBundle mainBundle];
fp = [bundle pathForResource: @"Info-project" ofType: @"plist"];
infoDict = [[NSDictionary dictionaryWithContentsOfFile: fp] retain];
}
[[NSApplication sharedApplication] orderFrontStandardInfoPanelWithOptions: infoDict];
}
- (void)showHelloWindow:(id)sender
{
if (!hello)
hello = [[Hello alloc] init];
[hello makeKeyAndOrderFront];
}
@end
|