From f81e97726a2f08416e90e5694e65d2d9d52ab0cd Mon Sep 17 00:00:00 2001 From: Scott Kyle Date: Tue, 2 Mar 2010 11:58:44 -0800 Subject: [PATCH] Fixed setName: in CPImage to return BOOL as in Cocoa --- AppKit/CPImage.j | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/AppKit/CPImage.j b/AppKit/CPImage.j index 0bc69ba608..53a3f19376 100644 --- a/AppKit/CPImage.j +++ b/AppKit/CPImage.j @@ -193,6 +193,9 @@ function CPAppKitImage(aFilename, aSize) var imageOrSize = AppKitImageForNames[aName]; + if (!imageOrSize) + return nil; + if (!imageOrSize.isa) { imageOrSize = CPAppKitImage("CPImage/" + aName + ".png", imageOrSize); @@ -205,17 +208,19 @@ function CPAppKitImage(aFilename, aSize) return imageOrSize; } -- (void)setName:(CPString)aName +- (BOOL)setName:(CPString)aName { if (_name === aName) - return; + return YES; - if (imagesForNames[aName] === self) - imagesForNames[aName] = nil; + if (imagesForNames[aName]) + return NO; _name = aName; imagesForNames[aName] = self; + + return YES; } - (CPString)name