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