discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Home directory support and icon for GNUstep


From: Jeff Teunissen
Subject: Re: Home directory support and icon for GNUstep
Date: Mon, 25 Mar 2002 02:06:43 -0500

Jeff Teunissen wrote:

> A small amount of work done on NSWorkspace. The icon it uses is kind of
> ugly, but it's free.

Updated the patch. It now falls back to the default folder icon if
HomeDirectory and common_HomeDirectory are not found. This way, people can put
their own HomeDirectory.tiff files into System/Libraries/Resources/Images and
expect them to work, while it doesn't break the current system, which lacks a
home directory image for copyright reasons.

I'll work on a free home directory icon in my copious free time.

-- 
| Jeff Teunissen  -=-  Pres., Dusk To Dawn Computing  -=-  deek @ d2dc.net
| GPG: 1024D/9840105A   7102 808A 7733 C2F3 097B  161B 9222 DAB8 9840 105A
| Core developer, The QuakeForge Project        http://www.quakeforge.net/
| Specializing in Debian GNU/Linux              http://www.d2dc.net/~deek/
Index: gui/Source/NSWorkspace.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSWorkspace.m,v
retrieving revision 1.47
diff -u -r1.47 NSWorkspace.m
--- gui/Source/NSWorkspace.m    22 Jan 2002 18:23:56 -0000      1.47
+++ gui/Source/NSWorkspace.m    25 Mar 2002 07:01:14 -0000
@@ -175,6 +175,7 @@
 - (NSImage*) folderImage;
 - (NSImage*) unknownFiletypeImage;
 - (NSImage*) rootImage;
+- (NSImage*) homeDirectoryImage;
 - (NSImage*) _iconForExtension: (NSString*)ext;
 - (BOOL) _extension: (NSString*)ext
                role: (NSString*)role
@@ -683,6 +684,8 @@
            {
              if ([aPath isEqual: _rootPath])
                image = [self rootImage];
+             else if ([aPath isEqual: NSHomeDirectory()])
+               image = [self homeDirectoryImage];
              else
                image = [self folderImage];
            }
@@ -1320,6 +1323,25 @@
     {
       image = RETAIN([self _getImageWithName: @"Folder.tiff"
                                   alternate: @"common_Folder.tiff"]);
+    }
+
+  return image;
+}
+
+/** Returns the default icon to display for the user's home directory */
+- (NSImage*) homeDirectoryImage
+{
+  static NSImage *image = nil;
+
+  if (image == nil)
+    {
+      image = RETAIN([self _getImageWithName: @"HomeDirectory.tiff"
+                                  alternate: @"common_HomeDirectory.tiff"]);
+    }
+
+  if (image == nil)
+    {
+      image = [self folderImage];
     }
 
   return image;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]