In [update] use [NSApplication targetForAction:to:from:] to be

consistent with the [performActionForItemAtIndex:] implementation.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@17660 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2003-09-13 13:38:46 +00:00
parent bbeec6b247
commit 2882fa9d28

View file

@ -750,7 +750,6 @@ static NSNotificationCenter *nc;
{ {
NSMenuItem *item = [_items objectAtIndex: i]; NSMenuItem *item = [_items objectAtIndex: i];
SEL action = [item action]; SEL action = [item action];
id target;
id validator = nil; id validator = nil;
BOOL wasEnabled = [item isEnabled]; BOOL wasEnabled = [item isEnabled];
BOOL shouldBeEnabled; BOOL shouldBeEnabled;
@ -762,35 +761,17 @@ static NSNotificationCenter *nc;
// If there is no action - there can be no validator for the item. // If there is no action - there can be no validator for the item.
if (action) if (action)
{ {
// If there is a target use that for validation (or nil). validator = [NSApp targetForAction: action
if (nil != (target = [item target])) to: [item target]
{ from: item];
if ([target respondsToSelector: action])
{
validator = target;
}
}
else
{
validator = [NSApp targetForAction: action];
}
} }
else if (_popUpButtonCell != nil) else if (_popUpButtonCell != nil)
{ {
if (NULL != (action = [_popUpButtonCell action])) if (NULL != (action = [_popUpButtonCell action]))
{ {
// If there is a target use that for validation (or nil). validator = [NSApp targetForAction: action
if (nil != (target = [_popUpButtonCell target])) to: [_popUpButtonCell target]
{ from: [_popUpButtonCell controlView]];
if ([target respondsToSelector: action])
{
validator = target;
}
}
else
{
validator = [NSApp targetForAction: action];
}
} }
} }