forked from torifat/iAvro
-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.m
45 lines (34 loc) · 1.37 KB
/
main.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/21/12.
// Copyright (c) 2012 OmicronLab. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import <InputMethodKit/InputMethodKit.h>
#import "AvroParser.h"
#import "Suggestion.h"
#import "Candidates.h"
//Each input method needs a unique connection name.
//Note that periods and spaces are not allowed in the connection name.
const NSString* kConnectionName = @"Avro_Keyboard_Connection";
//let this be a global so our application controller delegate can access it easily
IMKServer* server;
int main(int argc, char *argv[]) {
NSString* identifier;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[AvroParser sharedInstance];
[Suggestion sharedInstance];
//find the bundle identifier and then initialize the input method server
identifier = [[NSBundle mainBundle] bundleIdentifier];
server = [[IMKServer alloc] initWithName:(NSString*)kConnectionName bundleIdentifier:identifier];
[Candidates allocateSharedInstanceWithServer:server];
//load the bundle explicitly because in this case the input method is a background only application
[NSBundle loadNibNamed:@"MainMenu" owner:[NSApplication sharedApplication]];
//finally run everything
[[NSApplication sharedApplication] run];
[Candidates deallocateSharedInstance];
[server release];
[pool release];
return 0;
}