Revision: 12366
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=12366&view=rev
Author:   amaxwell
Date:     2008-01-08 09:20:47 -0800 (Tue, 08 Jan 2008)

Log Message:
-----------
Always fall back to finder icon.  If WebKit can't load it, NSAttributedString 
won't load it either.

Revise Finder icon API to use a single public init method that takes any URL or 
nil.

Modified Paths:
--------------
    trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFinderIcon.h
    trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFinderIcon.m
    trunk/bibdesk_vendorsrc/amaxwell/FileView/FVWebViewIcon.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFinderIcon.h
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFinderIcon.h    2008-01-08 
17:03:22 UTC (rev 12365)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFinderIcon.h    2008-01-08 
17:20:47 UTC (rev 12366)
@@ -48,5 +48,4 @@
     BOOL            _drawsLinkBadge;
 }
 - (id)initWithFinderIconOfURL:(NSURL *)theURL;
-- (id)initWithURLScheme:(NSString *)scheme;
 @end

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFinderIcon.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFinderIcon.m    2008-01-08 
17:03:22 UTC (rev 12365)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFinderIcon.m    2008-01-08 
17:20:47 UTC (rev 12366)
@@ -82,8 +82,11 @@
 // nil URL will draw the missing file
 - (id)initWithFinderIconOfURL:(NSURL *)theURL;
 {
-    self = [super init];
-    if (self) {
+    if ([theURL isFileURL] == NO && [theURL scheme] != nil) {
+        self = [self initWithURLScheme:[theURL scheme]];
+    }
+    else if ((self = [super init])) {
+
         _iconType = FVFinderIconType;
         _iconRef = NULL;
         

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVWebViewIcon.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVWebViewIcon.m   2008-01-08 
17:03:22 UTC (rev 12365)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVWebViewIcon.m   2008-01-08 
17:20:47 UTC (rev 12366)
@@ -106,16 +106,12 @@
 - (id)initWithURL:(NSURL *)aURL;
 {    
     NSParameterAssert(nil != [aURL scheme]);
-    NSParameterAssert(NO == [aURL isFileURL] || [FVTextIcon 
canInitWithURL:aURL]); // we should only load local HTML files
     
     // if this is disabled or not an http URL, return a finder icon instead
     if (FVWebIconDisabled || (NO == [[aURL scheme] isEqualToString:@"http"] && 
NO == [aURL isFileURL])) {
         NSZone *zone = [self zone];
         [self release];
-        if ([aURL isFileURL])
-            self = [[FVTextIcon allocWithZone:zone] initWithTextAtURL:aURL];
-        else
-            self = [[FVFinderIcon allocWithZone:zone] initWithURLScheme:[aURL 
scheme]];
+        self = [[FVFinderIcon allocWithZone:zone] 
initWithFinderIconOfURL:aURL];
     }
     else if ((self = [super init])) {
         _httpURL = [aURL copy];
@@ -450,11 +446,9 @@
         [self 
performSelectorOnMainThread:@selector(renderOffscreenOnMainThread) 
withObject:nil waitUntilDone:NO];
     }
     else if (YES == _webviewFailed && nil == _fallbackIcon) {
-        if ([_httpURL isFileURL])
-            _fallbackIcon = [[FVTextIcon alloc] initWithTextAtURL:_httpURL];
-        else
-            _fallbackIcon = [[FVFinderIcon alloc] initWithURLScheme:[_httpURL 
scheme]];
+        _fallbackIcon = [[FVFinderIcon allocWithZone:[self zone]] 
initWithFinderIconOfURL:_httpURL];
     }
+    [_fallbackIcon renderOffscreen];
     pthread_mutex_unlock(&_mutex);
 }
 


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

Reply via email to