mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 21:13:35 +00:00
Changed validation for Toolbar items to be not hard coded
This commit is contained in:
@@ -14,10 +14,10 @@
|
|||||||
- (void)validate {
|
- (void)validate {
|
||||||
if(![self.view menu]) {
|
if(![self.view menu]) {
|
||||||
id target = [NSApp targetForAction:[self action] to:nil from:self];
|
id target = [NSApp targetForAction:[self action] to:nil from:self];
|
||||||
id windowController = [[self.view window] windowController];
|
|
||||||
BOOL isValid = (nil != target);
|
BOOL isValid = (nil != target);
|
||||||
if( [windowController respondsToSelector:@selector(validateToolbarItem:)]) {
|
id validateTarget = [NSApp targetForAction:@selector(validateToolbarItem:) to:nil from:self];
|
||||||
isValid &= [windowController validateToolbarItem:self];
|
if(validateTarget) {
|
||||||
|
isValid &= [validateTarget validateToolbarItem:self];
|
||||||
}
|
}
|
||||||
[self setEnabled:isValid];
|
[self setEnabled:isValid];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user