Author: rmottola
Date: Wed Apr 13 21:22:53 2016
New Revision: 39663

URL: http://svn.gna.org/viewcvs/gnustep?rev=39663&view=rev
Log:
Use different cache keys for icons and icons with link badge. Remove fail-over 
case which should not happen and Log a warning instead.

Modified:
    apps/gworkspace/trunk/ChangeLog
    apps/gworkspace/trunk/FSNode/FSNodeRepIcons.m

Modified: apps/gworkspace/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/gworkspace/trunk/ChangeLog?rev=39663&r1=39662&r2=39663&view=diff
==============================================================================
--- apps/gworkspace/trunk/ChangeLog     (original)
+++ apps/gworkspace/trunk/ChangeLog     Wed Apr 13 21:22:53 2016
@@ -1,3 +1,8 @@
+2016-04-13 Riccardo Mottola <[email protected]>
+
+       * FSNode/FSNodeRepIcons.m
+       Use different cache keys for icons and icons with link badge. Remove 
fail-over case which should not happen and Log a warning instead.
+
 2016-04-12 Riccardo Mottola <[email protected]>
 
        * GWorkspace/Desktop/Dock/Dock.m

Modified: apps/gworkspace/trunk/FSNode/FSNodeRepIcons.m
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/gworkspace/trunk/FSNode/FSNodeRepIcons.m?rev=39663&r1=39662&r2=39663&view=diff
==============================================================================
--- apps/gworkspace/trunk/FSNode/FSNodeRepIcons.m       (original)
+++ apps/gworkspace/trunk/FSNode/FSNodeRepIcons.m       Wed Apr 13 21:22:53 2016
@@ -185,14 +185,13 @@
            }
        }
     }  
-    
-  if (icon == nil)
+  else
     { // NOT DIRECTORY
+      NSString *realPath;
+
+      realPath = [nodepath stringByResolvingSymlinksInPath];
       if (usesThumbnails)
        {
-         NSString *realPath;
-
-         realPath = [nodepath stringByResolvingSymlinksInPath];
          icon = [self thumbnailForPath: realPath];
       
          if (icon) {
@@ -216,12 +215,13 @@
              }  
          }
        }
-    
+      // no thumbnail found
       if (icon == nil)
        {
-         NSString *ext = [[nodepath pathExtension] lowercaseString];
+          NSString *linkKey;
+         NSString *ext = [[realPath pathExtension] lowercaseString];
       
-         if (ext && ([ext isEqual: @""] == NO))
+         if (ext && [ext length])
            {
              key = ext;
            }
@@ -229,8 +229,14 @@
            {
              key = @"unknown";
            }
-      
-         icon = [self cachedIconOfSize: size forKey: key];
+          linkKey = nil;
+          if ([node isLink])
+            {
+              linkKey = [key stringByAppendingString:@"_linked"];
+              icon = [self cachedIconOfSize: size forKey: linkKey];
+            }
+          if (icon == nil)
+            icon = [self cachedIconOfSize: size forKey: key];
 
          if (icon == nil)
            {
@@ -245,35 +251,19 @@
                  [linkIcon compositeToPoint:NSMakePoint(0,0) 
operation:NSCompositeSourceOver];
                  [baseIcon unlockFocus];
                  [baseIcon autorelease];
+                  icon = [self cachedIconOfSize: size forKey: linkKey 
addBaseIcon: baseIcon];
                }
-             icon = [self cachedIconOfSize: size forKey: key addBaseIcon: 
baseIcon];
+              else
+                {
+                  icon = [self cachedIconOfSize: size forKey: key addBaseIcon: 
baseIcon];
+                }
            }
        }      
     }      
 
   if (icon == nil)
     {
-      NSSize icnsize;
-    
-      icon = [NSImage imageNamed: @"Unknown"];
-      icnsize = [icon size];
-      
-      if ([node isLink])
-        {
-          NSImage *linkIcon;
-          
-          linkIcon = [NSImage imageNamed:@"common_linkCursor"];
-          icon = [baseIcon copy];
-          [icon lockFocus];
-          [linkIcon compositeToPoint:NSMakePoint(0,0) 
operation:NSCompositeSourceOver];
-          [icon unlockFocus];
-          [icon autorelease];
-        }
-      
-
-      if ((icnsize.width > size) || (icnsize.height > size)){
-       icon = [self resizedIcon: icon ofSize: size];
-      }  
+      NSLog(@"Warning: No icon found for %@", nodepath);
     }
 
   return icon;


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to