Install gettext-0.18.1.1.tar.gz
[msysgit.git] / mingw / share / doc / gettext / examples / hello-objc-gnustep / AppController.m
blob96475cd38b7623a74be5005a3b4dbab2f8b6c829
1 /* Example for use of GNU gettext.
2    This file is in the public domain.
4    Source code of the AppController class.  */
6 #include "AppController.h"
7 #include "Hello.h"
9 @implementation AppController
11 static NSDictionary *infoDict = nil;
13 + (void)initialize
15   NSMutableDictionary *defaults = [NSMutableDictionary dictionary];
17   [[NSUserDefaults standardUserDefaults] registerDefaults: defaults];
18   [[NSUserDefaults standardUserDefaults] synchronize];
21 - (id)init
23   self = [super init];
24   return self;
27 - (void)dealloc
29   if (hello)
30     RELEASE (hello);
32   [super dealloc];
35 - (void)awakeFromNib
39 - (void)applicationDidFinishLaunching:(NSNotification *)notif
43 - (BOOL)applicationShouldTerminate:(id)sender
45   return YES;
48 - (void)applicationWillTerminate:(NSNotification *)notification
52 - (BOOL)application:(NSApplication *)application openFile:(NSString *)fileName
56 - (void)showPrefPanel:(id)sender
60 - (void)showInfoPanel:(id)sender
62   if (!infoDict)
63     {
64       NSString *fp;
65       NSBundle *bundle = [NSBundle mainBundle];
67       fp = [bundle pathForResource: @"Info-project" ofType: @"plist"];
68       infoDict = [[NSDictionary dictionaryWithContentsOfFile: fp] retain];
69     }
70   [[NSApplication sharedApplication] orderFrontStandardInfoPanelWithOptions: infoDict];
73 - (void)showHelloWindow:(id)sender
75   if (!hello)
76     hello = [[Hello alloc] init];
78   [hello makeKeyAndOrderFront];
81 @end