forked from torifat/iAvro
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMainMenuAppDelegate.m
More file actions
50 lines (41 loc) · 1.38 KB
/
MainMenuAppDelegate.m
File metadata and controls
50 lines (41 loc) · 1.38 KB
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
//
// AvroKeyboard
//
// Created by Rifat Nabi on 6/24/12.
// Copyright (c) 2012 OmicronLab. All rights reserved.
//
#import "MainMenuAppDelegate.h"
#import "RegexParser.h"
#import "AvroKeyboard-Swift.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.action = @selector(showPreferences:);
}
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"IncludeDictionary"]) {
NSLog(@"Loading Dictionary...");
[Database shared];
[RegexParser sharedInstance];
[CacheManager shared];
}
[AutoCorrect shared];
[self configureCandidate];
}
-(void)configureCandidate {
NSUserDefaults *defaultsDictionary = [NSUserDefaults standardUserDefaults];
[[Candidates sharedInstance] setPanelType:[defaultsDictionary integerForKey:@"CandidatePanelType"]];
}
// Currently doesn't work
- (void)applicationWillTerminate:(NSNotification *)notification {
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"IncludeDictionary"]) {
[[CacheManager shared] persist];
}
}
@end