added support for home directory image

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@13262 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
nico 2002-03-28 13:23:38 +00:00
parent 0b313c5e97
commit e66c02b88e

View file

@ -48,6 +48,7 @@
#include <AppKit/NSApplication.h> #include <AppKit/NSApplication.h>
#include <AppKit/NSImage.h> #include <AppKit/NSImage.h>
#include <AppKit/NSView.h> #include <AppKit/NSView.h>
#include <AppKit/NSPanel.h>
#include <AppKit/NSWindow.h> #include <AppKit/NSWindow.h>
#include <AppKit/NSScreen.h> #include <AppKit/NSScreen.h>
#include <AppKit/GSServicesManager.h> #include <AppKit/GSServicesManager.h>
@ -174,6 +175,7 @@ static NSString *GSWorkspaceNotification = @"GSWorkspaceNotification";
- (NSImage*) _getImageWithName: (NSString*)name - (NSImage*) _getImageWithName: (NSString*)name
alternate: (NSString*)alternate; alternate: (NSString*)alternate;
- (NSImage*) folderImage; - (NSImage*) folderImage;
- (NSImage*) homeDirectoryImage;
- (NSImage*) unknownFiletypeImage; - (NSImage*) unknownFiletypeImage;
- (NSImage*) rootImage; - (NSImage*) rootImage;
- (NSImage*) _iconForExtension: (NSString*)ext; - (NSImage*) _iconForExtension: (NSString*)ext;
@ -683,9 +685,17 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
if (image == nil || image == [self unknownFiletypeImage]) if (image == nil || image == [self unknownFiletypeImage])
{ {
if ([aPath isEqual: _rootPath]) if ([aPath isEqual: _rootPath])
image = [self rootImage]; {
image = [self rootImage];
}
else if ([aPath isEqual: NSHomeDirectory ()])
{
image = [self homeDirectoryImage];
}
else else
image = [self folderImage]; {
image = [self folderImage];
}
} }
} }
} }
@ -1326,6 +1336,20 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
return image; return image;
} }
/** Returns the default icon to display for the user home directory */
- (NSImage*) homeDirectoryImage
{
static NSImage *image = nil;
if (image == nil)
{
image = RETAIN([self _getImageWithName: @"HomeDirectory.tiff"
alternate: @"common_HomeDirectory.tiff"]);
}
return image;
}
/** Returns the default icon to display for a directory */ /** Returns the default icon to display for a directory */
- (NSImage*) unknownFiletypeImage - (NSImage*) unknownFiletypeImage
{ {