mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-11 08:40:44 +00:00
Add did and will implementations for when a file moves
This commit is contained in:
parent
bd2802f128
commit
09268f3e17
2 changed files with 19 additions and 5 deletions
|
@ -69,8 +69,8 @@ DEFINE_BLOCK_TYPE(GSNoEscapeReadWriteHandler, void, NSURL*, NSURL*);
|
|||
DEFINE_BLOCK_TYPE(GSNoEscapeNewURLHandler, void, NSURL*);
|
||||
DEFINE_BLOCK_TYPE(GSAccessorCallbackHandler, void, NSError*);
|
||||
DEFINE_BLOCK_TYPE(GSDualWriteURLCallbackHandler, void, NSURL*, NSURL*);
|
||||
DEFINE_BLOCK_TYPE_NO_ARGS(GSBatchAccessorHandler, void);
|
||||
DEFINE_BLOCK_TYPE(GSAccessorHandlerBlock, void, GSBatchAccessorHandler);
|
||||
DEFINE_BLOCK_TYPE_NO_ARGS(GSBatchAccessorCompletionHandler, void);
|
||||
DEFINE_BLOCK_TYPE(GSBatchAccessorCompositeBlock, void, GSBatchAccessorCompletionHandler);
|
||||
|
||||
@interface NSFileCoordinator : NSObject
|
||||
{
|
||||
|
@ -129,7 +129,7 @@ DEFINE_BLOCK_TYPE(GSAccessorHandlerBlock, void, GSBatchAccessorHandler);
|
|||
writingItemsAtURLs: (NSArray *)writingURLs
|
||||
options: (NSFileCoordinatorWritingOptions)writingOptions
|
||||
error: (NSError **)outError
|
||||
byAccessor: (GSAccessorHandlerBlock)batchAccessor;
|
||||
byAccessor: (GSBatchAccessorCompositeBlock)batchAccessor;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
|
@ -231,7 +231,7 @@ static NSMutableDictionary *__presenterMap = nil;
|
|||
- (void)itemAtURL: (NSURL *)oldURL willMoveToURL: (NSURL *)newURL
|
||||
{
|
||||
id<NSFilePresenter> presenter = [__presenterMap objectForKey: oldURL];
|
||||
[presenter presentedItemDidChange];
|
||||
[presenter presentedItemDidChange]; // there is no "Will" method for this, so I am a bit perplexed.
|
||||
}
|
||||
|
||||
- (void)itemAtURL: (NSURL *)url didChangeUbiquityAttributes: (NSSet *)attributes
|
||||
|
@ -245,8 +245,22 @@ static NSMutableDictionary *__presenterMap = nil;
|
|||
writingItemsAtURLs: (NSArray *)writingURLs
|
||||
options: (NSFileCoordinatorWritingOptions)writingOptions
|
||||
error: (NSError **)outError
|
||||
byAccessor: (GSAccessorHandlerBlock)batchAccessor
|
||||
byAccessor: (GSBatchAccessorCompositeBlock)batchAccessor
|
||||
{
|
||||
if(readingOptions == 0L)
|
||||
{
|
||||
NSEnumerator *en = [readingURLs objectEnumerator];
|
||||
NSURL *aurl = nil;
|
||||
while((aurl = [en nextObject]) != nil)
|
||||
{
|
||||
id<NSFilePresenter> p = [__presenterMap objectForKey: aurl];
|
||||
if([p respondsToSelector: @selector(savePresentedItemChangesWithCompletionHandler:)])
|
||||
{
|
||||
[p savePresentedItemChangesWithCompletionHandler:NULL];
|
||||
}
|
||||
}
|
||||
}
|
||||
// CALL_BLOCK(batchAccessor, batchAccessor.argTys[0]); // NOT SURE HOW TO CALL COMPOSITE BLOCK
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue