forked from torifat/iAvro
-
Notifications
You must be signed in to change notification settings - Fork 3
/
MainMenuAppDelegate.m
45 lines (37 loc) · 1.18 KB
/
MainMenuAppDelegate.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
//
// AvroKeyboard
//
// Created by Rifat Nabi on 6/24/12.
// Copyright (c) 2012 OmicronLab. All rights reserved.
//
#import "MainMenuAppDelegate.h"
#import "AutoCorrect.h"
#import "CacheManager.h"
#import "Database.h"
#import "RegexParser.h"
@implementation MainMenuAppDelegate
//this method is added so that our controllers can access the shared NSMenu.
-(NSMenu*)menu {
return _menu;
}
//add an awakeFromNib item so that we can set the action method. Note that any menuItems without an action will be disabled when
//displayed in the Text Input Menu.
-(void)awakeFromNib {
NSMenuItem* preferences = [_menu itemWithTag:1];
if (preferences) {
[preferences setAction:@selector(showPreferences:)];
}
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"IncludeDictionary"]) {
NSLog(@"Loading Dictionary...");
[Database sharedInstance];
[RegexParser sharedInstance];
[CacheManager sharedInstance];
}
[AutoCorrect sharedInstance];
}
- (void)applicationWillTerminate:(NSNotification *)notification {
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"IncludeDictionary"]) {
[[CacheManager sharedInstance] persist];
}
}
@end