-
Notifications
You must be signed in to change notification settings - Fork 2
/
NSPreferencesPatches.m
33 lines (26 loc) · 1.21 KB
/
NSPreferencesPatches.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
//
// NSPreferencesPatches.m
// ABKeyManager
//
// Created by Robert Goldsmith on 14/02/2005.
// Copyright 2005 Far-Blue. All rights reserved.
//
#import "NSPreferencesPatches.h"
#import "PatchingFunctions.h"
@implementation NSPreferencesPatches
+(void)initialize
{
registerMethodFromClassInNewClassAndRenameOldMethodFromThisNewClass(@"NSPreferencesPatches", @selector(toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar:), @"NSPreferences", @"originalToolbar:itemForItemIdentifier:willBeInsertedIntoToolbar:");
}
//hack to fix a problem whereby although you give the preference pane a name
//when you add it to the preferences, something somewhere still uses the class name
//and everything gets screwed and the pane doesn't display. Catching the
//class name identifier here and changing it for the name by which the pane was
//registered in the ABKeyManager initialize method allows everything to work
-(id)toolbar:(id)toolbar itemForItemIdentifier:(id)itemIdentifier willBeInsertedIntoToolbar:(BOOL)insert
{
if([itemIdentifier isEqualToString:@"ABGPGPreferenceModule"])
itemIdentifier=@"PGP";
return [self originalToolbar:toolbar itemForItemIdentifier:itemIdentifier willBeInsertedIntoToolbar:insert];
}
@end