From d22537f16f3d38c537a143de4e392c355dd3085b Mon Sep 17 00:00:00 2001 From: rmottola Date: Wed, 9 Mar 2016 23:39:52 +0000 Subject: [PATCH] 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 --- ChangeLog | 5 +++++ Source/NSWorkspace.m | 20 +++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f6c1d103d..631a15e32 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-03-10 Riccardo Mottola + + * 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 * Headers/AppKit/NSImage.h diff --git a/Source/NSWorkspace.m b/Source/NSWorkspace.m index 54f2b105c..702e60023 100644 --- a/Source/NSWorkspace.m +++ b/Source/NSWorkspace.m @@ -675,6 +675,7 @@ static NSDictionary *urlPreferences = nil; NSArray *desktopDir; NSArray *imgDir; NSArray *musicDir; + NSArray *videoDir; NSString *sysDir; NSUInteger i; @@ -729,7 +730,9 @@ 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; if ([sysAppDir count] > 0) @@ -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; }