-
Notifications
You must be signed in to change notification settings - Fork 2
/
ABCardWindowControllerPatches.m
51 lines (37 loc) · 1.44 KB
/
ABCardWindowControllerPatches.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
//
// ABCardWindowControllerPatches.m
// ABKeyManager
//
// Created by Robert Goldsmith on 12/03/2005.
// Copyright 2005 Far-Blue. All rights reserved.
//
#import "ABCardWindowControllerPatches.h"
#import "PatchingFunctions.h"
#import "ABKeyWindowAugmentationsManager.h"
#import "GPGMEController.h"
@implementation ABCardWindowControllerPatches
+(void)initialize
{
registerMethodFromClassInNewClassAndRenameOldMethodFromThisNewClass (@"ABCardWindowControllerPatches", @selector(validateMenuItem:), @"ABCardWindowController", @"originalValidateMenuItem:");
registerMethodFromClassInNewClassAndRenameOldMethodFromThisNewClass (@"ABCardWindowControllerPatches", @selector(windowWillClose:), @"ABCardWindowController", @"originalWindowWillClose:");
registerMethodWithNewClass(@"ABCardWindowControllerPatches", @selector(inputController),@"ABCardWindowController");
}
-(id)inputController
{
id inputController;
object_getInstanceVariable(self,"_cardInputController" ,(void **)&inputController);
return inputController;
}
-(BOOL)validateMenuItem:(id)sender
{
if([sender tag]==255)//GPGMail Options info
return ![[self inputController] isFieldVisible:@"GPGOptions"];
return [self originalValidateMenuItem:sender];
}
-(void)windowWillClose:(id)foo
{
[ABKeyWindowAugmentationsManager removeWindow:[self window]];
[[GPGMEController sharedController] removeObserver:[self inputController]];
[self originalWindowWillClose:foo];
}
@end