2004-10-30 Alex Perez <aperez@student.santarosa.edu>

* Headers/AppKit/NSImage.h (+_standardImageWithName:): New method.
	* Source/NSImage.m (+_standardImageWithName:): New method.
	* Source/NSWorkspace.m (_getImageForName:alternate:): Remove. Update
	callers to use +_standardImageWithName: instead.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20270 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Alexander Malmberg 2004-10-30 11:19:07 +00:00
parent 50bad4da8e
commit df0ff73e62
4 changed files with 33 additions and 30 deletions

View file

@ -1,3 +1,10 @@
2004-10-30 Alex Perez <aperez@student.santarosa.edu>
* Headers/AppKit/NSImage.h (+_standardImageWithName:): New method.
* Source/NSImage.m (+_standardImageWithName:): New method.
* Source/NSWorkspace.m (_getImageForName:alternate:): Remove. Update
callers to use +_standardImageWithName: instead.
2004-10-25 Quentin Mathe <qmathe@club-internet.fr>
* Source/NSWorkspace.m: Moved the code which looks for the application

View file

@ -102,6 +102,11 @@ typedef enum {
// Referring to Images by Name
//
+ (id) imageNamed: (NSString*)aName;
#ifndef STRICT_OPENSTEP
#ifndef NO_GNUSTEP
+ (NSImage*) _standardImageWithName: (NSString*)name;
#endif
#endif
- (BOOL) setName: (NSString*)aName;
- (NSString*) name;

View file

@ -273,6 +273,16 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
return image;
}
+ (NSImage *) _standardImageWithName: (NSString *)name
{
NSImage *image = nil;
image = [NSImage imageNamed: name];
if (image == nil)
image = [NSImage imageNamed: [@"common_" stringByAppendingString: name]];
return image;
}
- (id) init
{
return [self initWithSize: NSMakeSize(0, 0)];

View file

@ -175,14 +175,11 @@ static NSString *GSWorkspaceNotification = @"GSWorkspaceNotification";
@end
@interface NSWorkspace (Private)
// Icon handling
- (NSImage*) _extIconForApp: (NSString*)appName info: (NSDictionary*)extInfo;
- (NSImage*) _getImageWithName: (NSString*)name
alternate: (NSString*)alternate;
- (NSImage*) unknownFiletypeImage;
- (NSImage*) _saveImageFor: (NSString*)iconPath;
- (NSString*) thumbnailForFile: (NSString *)file;
@ -853,9 +850,8 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
{
if (rootImage == nil)
{
rootImage = RETAIN([self _getImageWithName:
@"Root_PC.tiff"
alternate: @"common_Root_PC.tiff"]);
rootImage = RETAIN([NSImage _standardImageWithName:
@"Root_PC.tiff"]);
}
image = rootImage;
@ -864,9 +860,8 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
{
if (homeImage == nil)
{
homeImage = RETAIN([self _getImageWithName:
@"HomeDirectory.tiff"
alternate: @"common_HomeDirectory.tiff"]);
homeImage = RETAIN([NSImage _standardImageWithName:
@"HomeDirectory.tiff"]);
}
image = homeImage;
}
@ -874,8 +869,8 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
{
if (folderImage == nil)
{
folderImage = RETAIN([self _getImageWithName:
@"Folder.tiff" alternate: @"common_Folder.tiff"]);
folderImage = RETAIN([NSImage _standardImageWithName:
@"Folder.tiff"]);
}
image = folderImage;
}
@ -916,9 +911,8 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
{
if (unknownTool == nil)
{
unknownTool = RETAIN([self _getImageWithName:
@"UnknownTool.tiff" alternate:
@"common_UnknownTool.tiff"]);
unknownTool = RETAIN([NSImage _standardImageWithName:
@"UnknownTool.tiff"]);
}
image = unknownTool;
}
@ -1679,17 +1673,6 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
return nil;
}
- (NSImage*) _getImageWithName: (NSString*)name
alternate: (NSString*)alternate
{
NSImage *image = nil;
image = [NSImage imageNamed: name];
if (image == nil)
image = [NSImage imageNamed: alternate];
return image;
}
/** Returns the default icon to display for a directory */
- (NSImage*) unknownFiletypeImage
{
@ -1697,8 +1680,7 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
if (image == nil)
{
image = RETAIN([self _getImageWithName: @"Unknown.tiff"
alternate: @"common_Unknown.tiff"]);
image = RETAIN([NSImage _standardImageWithName: @"Unknown.tiff"]);
}
return image;
@ -1830,9 +1812,8 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
{
if (unknownApplication == nil)
{
unknownApplication = RETAIN([self _getImageWithName:
@"UnknownApplication.tiff" alternate:
@"common_UnknownApplication.tiff"]);
unknownApplication = RETAIN([NSImage _standardImageWithName:
@"UnknownApplication.tiff"]);
}
icon = unknownApplication;
}