Revision: 21377
http://sourceforge.net/p/bibdesk/svn/21377
Author: hofman
Date: 2017-04-08 16:33:22 +0000 (Sat, 08 Apr 2017)
Log Message:
-----------
separate method to change file url for linked file and notify delegate
Modified Paths:
--------------
trunk/bibdesk/BDSKLinkedFile.m
Modified: trunk/bibdesk/BDSKLinkedFile.m
===================================================================
--- trunk/bibdesk/BDSKLinkedFile.m 2017-04-08 06:19:22 UTC (rev 21376)
+++ trunk/bibdesk/BDSKLinkedFile.m 2017-04-08 16:33:22 UTC (rev 21377)
@@ -425,6 +425,15 @@
}
}
+- (void)setFileURL:(NSURL *)aURL {
+ if (aURL != fileURL) {
+ [fileURL release];
+ fileURL = [aURL retain];
+ if (isInitial == NO)
+ [delegate performSelector:@selector(linkedFileURLChanged:)
withObject:self afterDelay:0.0];
+ }
+}
+
- (void)updateFileRef;
{
NSString *basePath = [delegate basePathForLinkedFile:self];
@@ -500,10 +509,7 @@
if (BDSKPathToFSRef((CFStringRef)basePath, &aRef))
[self updateWithPath:[(NSURL *)aURL path] basePath:basePath
baseRef:&aRef];
}
- [fileURL release];
- fileURL = [(NSURL *)aURL retain];
- if (isInitial == NO)
- [delegate performSelector:@selector(linkedFileURLChanged:)
withObject:self afterDelay:0.0];
+ [self setFileURL:(NSURL *)aURL];
}
isInitial = NO;
return [(NSURL *)aURL autorelease];
@@ -607,15 +613,12 @@
if (BDSKPathToFSRef((CFStringRef)aPath, &aRef)) {
NSURL *aURL = (NSURL *)CFURLCreateFromFSRef(NULL, &aRef);
if ([path isEqualToString:[aURL path]]) {
- [aURL release];
needsUpdate = NO;
} else {
[self setFileRef:&aRef];
- [fileURL release];
- fileURL = aURL;
- if (isInitial == NO)
- [delegate
performSelector:@selector(linkedFileURLChanged:) withObject:self
afterDelay:0.0];
+ [self setFileURL:aURL];
}
+ [aURL release];
}
if (needsUpdate) {
if (BDSKPathToFSRef((CFStringRef)basePath, &aRef))
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit