Skip to content

Commit

Permalink
Fixed setName: in CPImage to return BOOL as in Cocoa
Browse files Browse the repository at this point in the history
  • Loading branch information
appden authored and Ross Boucher committed Jun 21, 2010
1 parent 8f040d6 commit f81e977
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions AppKit/CPImage.j
Expand Up @@ -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);
Expand All @@ -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
Expand Down

0 comments on commit f81e977

Please sign in to comment.