Add fall-back that if a folder image is not found, the generic folde ricon is picked up. Also add Movies special folders

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@39513 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rmottola 2016-03-09 23:39:52 +00:00
parent 74ae5822ea
commit d22537f16f
2 changed files with 22 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2016-03-10 Riccardo Mottola <rm@gnu.org>
* Source/NSWorkspace.m
Add fall-back that if a folder image is not found, the generic folde ricon is picked up. Also add Movies special folders.
2016-03-09 Riccardo Mottola <rm@gnu.org>
* Headers/AppKit/NSImage.h

View file

@ -675,6 +675,7 @@ static NSDictionary *urlPreferences = nil;
NSArray *desktopDir;
NSArray *imgDir;
NSArray *musicDir;
NSArray *videoDir;
NSString *sysDir;
NSUInteger i;
@ -729,6 +730,8 @@ static NSDictionary *urlPreferences = nil;
NSUserDomainMask, YES);
musicDir = NSSearchPathForDirectoriesInDomains(NSMusicDirectory,
NSUserDomainMask, YES);
videoDir = NSSearchPathForDirectoriesInDomains(NSMoviesDirectory,
NSUserDomainMask, YES);
/* we try to guess a System directory and check if looks like one */
sysDir = nil;
@ -778,6 +781,11 @@ static NSDictionary *urlPreferences = nil;
[folderPathIconDict setObject: @"MusicFolder"
forKey: [musicDir objectAtIndex: i]];
}
for (i = 0; i < [videoDir count]; i++)
{
[folderPathIconDict setObject: @"VideoFolder"
forKey: [videoDir objectAtIndex: i]];
}
folderIconCache = [[NSMutableDictionary alloc] init];
return self;
@ -1457,8 +1465,14 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
if (iconImage == nil)
{
iconImage = [NSImage _standardImageWithName: iconName];
/* the dictionary retains the image */
[folderIconCache setObject: iconImage forKey: iconName];
if (!iconImage)
{
/* no specific image found in theme, fall-back to folder */
NSLog(@"no image found for %@", iconName);
iconImage = [NSImage _standardImageWithName: @"Folder"];
}
/* the dictionary retains the image */
[folderIconCache setObject: iconImage forKey: iconName];
}
image = iconImage;
}