-
Notifications
You must be signed in to change notification settings - Fork 165
/
RHAppDelegate.m
executable file
·54 lines (42 loc) · 1.72 KB
/
RHAppDelegate.m
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
//
// RHAppDelegate.m
// RHPreferencesTester
//
// Created by Richard Heard on 23/05/12.
// Copyright (c) 2012 Richard Heard. All rights reserved.
//
#import "RHAppDelegate.h"
#import "RHAboutViewController.h"
#import "RHAccountsViewController.h"
#import "RHWideViewController.h"
@implementation RHAppDelegate
@synthesize window = _window;
@synthesize preferencesWindowController=_preferencesWindowController;
- (void)dealloc
{
[_preferencesWindowController release]; _preferencesWindowController = nil;
[super dealloc];
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Insert code here to initialize your application
}
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication {
return YES;
}
#pragma mark - IBActions
-(IBAction)showPreferences:(id)sender{
//if we have not created the window controller yet, create it now
if (!_preferencesWindowController){
RHAccountsViewController *accounts = [[[RHAccountsViewController alloc] init] autorelease];
RHAboutViewController *about = [[[RHAboutViewController alloc] init] autorelease];
RHWideViewController *wide = [[[RHWideViewController alloc] init] autorelease];
NSArray *controllers = [NSArray arrayWithObjects:accounts, wide,
[RHPreferencesWindowController flexibleSpacePlaceholderController],
about,
nil];
_preferencesWindowController = [[RHPreferencesWindowController alloc] initWithViewControllers:controllers andTitle:NSLocalizedString(@"Preferences", @"Preferences Window Title")];
}
[_preferencesWindowController showWindow:self];
}
@end