Revision: 12382
http://bibdesk.svn.sourceforge.net/bibdesk/?rev=12382&view=rev
Author: amaxwell
Date: 2008-01-08 22:02:57 -0800 (Tue, 08 Jan 2008)
Log Message:
-----------
Try a Quick Look icon if all others fail. If it doesn't exist or returns nil
(disabled), use a Finder icon.
Modified Paths:
--------------
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon.m
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon_Private.h
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVQLIcon.m
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon.m 2008-01-09 02:04:02 UTC
(rev 12381)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon.m 2008-01-09 06:02:57 UTC
(rev 12382)
@@ -218,6 +218,11 @@
anIcon = [[FVQLIconClass allocWithZone:[self zone]]
initWithURL:representedURL];
}
+ // In case some subclass returns nil, fall back to Quick Look. If
disabled, it returns nil.
+ if (nil == anIcon && Nil != FVQLIconClass)
+ anIcon = [[FVQLIconClass allocWithZone:[self zone]]
initWithURL:representedURL];
+
+ // In case all subclasses failed, fall back to a Finder icon.
if (nil == anIcon)
anIcon = [[FVFinderIcon allocWithZone:[self zone]]
initWithFinderIconOfURL:representedURL];
@@ -336,18 +341,22 @@
return strdup(temp);
}
-FV_PRIVATE_EXTERN char * FVCreateDiskCacheNameWithURL(NSURL *fileURL)
+FV_PRIVATE_EXTERN char * FVCreateDiskCacheNameWithURL(NSURL *aURL)
{
+ NSCParameterAssert(nil != aURL);
#if DEBUG
- // this is a much more useful name for debugging, but it's slower and not
unique
- NSCParameterAssert([fileURL isFileURL]);
- return strdup([[fileURL path] fileSystemRepresentation]);
+ // this is a much more useful name for debugging, but it's slower and
breaks if the name changes
+ return strdup([[aURL absoluteString] fileSystemRepresentation]);
#endif
- struct stat sb;
char *name = NULL;
- if (0 == stat([[fileURL path] fileSystemRepresentation], &sb)) {
- name = FVCreateCStringWithInode(sb.st_ino);
+ if ([aURL isFileURL]) {
+ struct stat sb;
+ if (0 == stat([[aURL path] fileSystemRepresentation], &sb))
+ name = FVCreateCStringWithInode(sb.st_ino);
}
+ else {
+ name = strdup([[aURL absoluteString] fileSystemRepresentation]);
+ }
return name;
}
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon_Private.h
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon_Private.h 2008-01-09
02:04:02 UTC (rev 12381)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon_Private.h 2008-01-09
06:02:57 UTC (rev 12382)
@@ -65,6 +65,6 @@
- (void)_drawBadgeInContext:(CGContextRef)context
forIconInRect:(NSRect)dstRect;
@end
-FV_PRIVATE_EXTERN char * FVCreateDiskCacheNameWithURL(NSURL *fileURL);
+FV_PRIVATE_EXTERN char * FVCreateDiskCacheNameWithURL(NSURL *aURL);
FV_PRIVATE_EXTERN NSString * const FVWebIconUpdatedNotificationName;
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVQLIcon.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVQLIcon.m 2008-01-09
02:04:02 UTC (rev 12381)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVQLIcon.m 2008-01-09
06:02:57 UTC (rev 12382)
@@ -56,9 +56,8 @@
- (id)initWithURL:(NSURL *)theURL;
{
if (FVQLIconDisabled) {
- NSZone *zone = [self zone];
[self release];
- self = [[FVFinderIcon allocWithZone:zone]
initWithFinderIconOfURL:theURL];
+ self = nil;
}
else if ((self = [super init])) {
// QL seems to fail a large percentage of the time on my system, and
it's also pretty slow. Since FVFinderIcon is now fast and relatively low
overhead, preallocate the fallback icon to avoid waiting for QL to return NULL.
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit