blob: d11bdc9024cfeb7606a56b4ed7aa8fde602625d3 [file] [log] [blame]
Alexandre Lision5855b6a2015-02-03 11:31:05 -05001#import "AppDelegate.h"
2
3
4@implementation AppDelegate
5
6- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
7 self.ringWindowController = [[RingWindowController alloc] initWithWindowNibName:@"RingWindow"];
8 [self.ringWindowController showWindow:nil];
9}
10
11- (PreferencesWindowController *)preferencesWindowController
12{
13 if (!_preferencesWindowController)
14 {
15 NSLog(@"Coucou");
16 _preferencesWindowController = [[PreferencesWindowController alloc] initWithWindowNibName:@"PreferencesWindow"];
17 _preferencesWindowController.window.restorable = YES;
18 _preferencesWindowController.window.restorationClass = [self class];
19 _preferencesWindowController.window.identifier = @"preferences";
20 }
21 return _preferencesWindowController;
22}
23
24- (IBAction)launchPreferencesWindow:(id)sender {
25 [[self preferencesWindowController] showWindow:nil];
26}
27
28+ (void)restoreWindowWithIdentifier:(NSString *)identifier
29 state:(NSCoder *)state
30 completionHandler:(void (^)(NSWindow *, NSError *))completionHandler
31{
32 NSLog(@"restoreWindowWithIdentifier: %@", identifier);
33 NSWindow *window = nil;
34 if ([identifier isEqualToString:@"preferences"])
35 {
36 AppDelegate *appDelegate = [NSApp delegate];
37 window = [[appDelegate preferencesWindowController] window];
38 }
39 completionHandler(window, nil);
40}
41
42@end