From 2882fa9d28cc51316b34c65eafb5e7548c1d42f8 Mon Sep 17 00:00:00 2001 From: Fred Kiefer Date: Sat, 13 Sep 2003 13:38:46 +0000 Subject: [PATCH] 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 --- Source/NSMenu.m | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/Source/NSMenu.m b/Source/NSMenu.m index d3badd032..9b554a0b8 100644 --- a/Source/NSMenu.m +++ b/Source/NSMenu.m @@ -750,7 +750,6 @@ static NSNotificationCenter *nc; { NSMenuItem *item = [_items objectAtIndex: i]; SEL action = [item action]; - id target; id validator = nil; BOOL wasEnabled = [item isEnabled]; BOOL shouldBeEnabled; @@ -762,35 +761,17 @@ static NSNotificationCenter *nc; // If there is no action - there can be no validator for the item. if (action) { - // If there is a target use that for validation (or nil). - if (nil != (target = [item target])) - { - if ([target respondsToSelector: action]) - { - validator = target; - } - } - else - { - validator = [NSApp targetForAction: action]; - } + validator = [NSApp targetForAction: action + to: [item target] + from: item]; } else if (_popUpButtonCell != nil) { if (NULL != (action = [_popUpButtonCell action])) { - // If there is a target use that for validation (or nil). - if (nil != (target = [_popUpButtonCell target])) - { - if ([target respondsToSelector: action]) - { - validator = target; - } - } - else - { - validator = [NSApp targetForAction: action]; - } + validator = [NSApp targetForAction: action + to: [_popUpButtonCell target] + from: [_popUpButtonCell controlView]]; } }