Revision: 22401
http://sourceforge.net/p/bibdesk/svn/22401
Author: hofman
Date: 2018-07-10 16:52:13 +0000 (Tue, 10 Jul 2018)
Log Message:
-----------
Use already existing distributed notification observer
Modified Paths:
--------------
trunk/bibdesk/BDSKAppController.m
trunk/bibdesk/BDSKLinkedFile.h
trunk/bibdesk/BDSKLinkedFile.m
trunk/bibdesk/BibDocument.h
trunk/bibdesk/BibDocument.m
trunk/bibdesk/BibDocument_UI.m
Modified: trunk/bibdesk/BDSKAppController.m
===================================================================
--- trunk/bibdesk/BDSKAppController.m 2018-07-10 16:27:27 UTC (rev 22400)
+++ trunk/bibdesk/BDSKAppController.m 2018-07-10 16:52:13 UTC (rev 22401)
@@ -91,7 +91,6 @@
#define BDSKHistoryByDateKey @"BDSKHistoryByDate"
#define BDSKIsRelaunchKey @"BDSKIsRelaunch"
#define BDSKDidMigrateLocalUrlFormatDefaultsKey
@"BDSKDidMigrateLocalUrlFormatDefaultsKey"
-#define SKSkimFileDidSaveNotification @"SKSkimFileDidSaveNotification"
enum {
BDSKStartupOpenUntitledFile,
@@ -104,7 +103,6 @@
@interface BDSKAppController (Private)
- (void)doSpotlightImportIfNeeded;
- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event
withReplyEvent:(NSAppleEventDescriptor *)replyEvent;
-- (void)handleSkimFileDidSaveNotification:(NSNotification *)note;
@end
@implementation BDSKAppController
@@ -359,8 +357,6 @@
[history loadFromURL:[NSURL fileURLWithPath:historyPath] error:NULL];
[WebHistory setOptionalSharedHistory:history];
- [[NSDistributedNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleSkimFileDidSaveNotification:)
name:SKSkimFileDidSaveNotification object:nil];
-
[[NSColorPanel sharedColorPanel] setShowsAlpha:YES];
}
@@ -875,10 +871,4 @@
}
}
-#pragma mark Skim Files
-
-- (void)handleSkimFileDidSaveNotification:(NSNotification *)note {
- [[NSApp orderedDocuments]
makeObjectsPerformSelector:@selector(SkimFileDidSave:) withObject:[note
object]];
-}
-
@end
Modified: trunk/bibdesk/BDSKLinkedFile.h
===================================================================
--- trunk/bibdesk/BDSKLinkedFile.h 2018-07-10 16:27:27 UTC (rev 22400)
+++ trunk/bibdesk/BDSKLinkedFile.h 2018-07-10 16:52:13 UTC (rev 22401)
@@ -77,7 +77,7 @@
- (BOOL)hasSkimNotes;
-- (void)updateSkimNotesForPath:(NSString *)path;
+- (void)updateHasSkimNotes;
@end
Modified: trunk/bibdesk/BDSKLinkedFile.m
===================================================================
--- trunk/bibdesk/BDSKLinkedFile.m 2018-07-10 16:27:27 UTC (rev 22400)
+++ trunk/bibdesk/BDSKLinkedFile.m 2018-07-10 16:52:13 UTC (rev 22401)
@@ -698,12 +698,10 @@
relativePath = [[path relativePathFromPath:basePath] retain];
}
-- (void)updateSkimNotesForPath:(NSString *)path {
- if ([path isEqualToString:[fileURL path]]) {
- hasSkimNotes = -1;
- if (isInitial == NO)
- [delegate performSelector:@selector(linkedFileURLChanged:)
withObject:self afterDelay:0.0];
- }
+- (void)updateHasSkimNotes {
+ hasSkimNotes = -1;
+ if (isInitial == NO)
+ [delegate performSelector:@selector(linkedFileURLChanged:)
withObject:self afterDelay:0.0];
}
@end
Modified: trunk/bibdesk/BibDocument.h
===================================================================
--- trunk/bibdesk/BibDocument.h 2018-07-10 16:27:27 UTC (rev 22400)
+++ trunk/bibdesk/BibDocument.h 2018-07-10 16:52:13 UTC (rev 22401)
@@ -432,6 +432,4 @@
- (BOOL)openLinkedFileURL:(NSURL *)url;
-- (void)SkimFileDidSave:(NSString *)path;
-
@end
Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2018-07-10 16:27:27 UTC (rev 22400)
+++ trunk/bibdesk/BibDocument.m 2018-07-10 16:52:13 UTC (rev 22401)
@@ -2694,10 +2694,4 @@
return [[NSWorkspace sharedWorkspace] openURL:url
withSearchString:searchString];
}
-#pragma mark Skim file did save
-
-- (void)SkimFileDidSave:(NSString *)path {
- [[[self publications] valueForKeyPath:@"@unionOfArrays.localFiles"]
makeObjectsPerformSelector:@selector(updateSkimNotesForPath:) withObject:path];
-}
-
@end
Modified: trunk/bibdesk/BibDocument_UI.m
===================================================================
--- trunk/bibdesk/BibDocument_UI.m 2018-07-10 16:27:27 UTC (rev 22400)
+++ trunk/bibdesk/BibDocument_UI.m 2018-07-10 16:52:13 UTC (rev 22401)
@@ -1242,8 +1242,11 @@
NSDictionary *notifInfo = [NSDictionary
dictionaryWithObjectsAndKeys:BDSKLocalFileString, BDSKBibItemKeyKey, nil];
for (BibItem *pub in publications) {
- if ([[[pub existingLocalFiles] valueForKey:@"path"]
containsObject:path])
- [[NSNotificationCenter defaultCenter]
postNotificationName:BDSKBibItemChangedNotification object:pub
userInfo:notifInfo];
+ for (BDSKLinkedFile *file in [pub localFiles]) {
+ if ([[file path] isEqualToString:path])
+ // this will send a BDSKBibItemChangedNotification
+ [file updateHasSkimNotes];
+ }
}
}
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