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