pub unsafe trait FIFinderSyncProtocol {
// Provided methods
unsafe fn menuForMenuKind(
&self,
menu: FIMenuKind,
mtm: MainThreadMarker,
) -> Option<Retained<NSMenu>>
where Self: Sized + Message { ... }
unsafe fn beginObservingDirectoryAtURL(&self, url: &NSURL)
where Self: Sized + Message { ... }
unsafe fn endObservingDirectoryAtURL(&self, url: &NSURL)
where Self: Sized + Message { ... }
unsafe fn requestBadgeIdentifierForURL(&self, url: &NSURL)
where Self: Sized + Message { ... }
unsafe fn toolbarItemName(&self) -> Retained<NSString>
where Self: Sized + Message { ... }
unsafe fn toolbarItemImage(&self) -> Retained<NSImage>
where Self: Sized + Message { ... }
unsafe fn toolbarItemToolTip(&self) -> Retained<NSString>
where Self: Sized + Message { ... }
unsafe fn supportedServiceNamesForItemWithURL(
&self,
item_url: &NSURL,
) -> Retained<NSArray<NSFileProviderServiceName>>
where Self: Sized + Message { ... }
unsafe fn makeListenerEndpointForServiceName_itemURL_andReturnError(
&self,
service_name: &NSFileProviderServiceName,
item_url: &NSURL,
) -> Result<Retained<NSXPCListenerEndpoint>, Retained<NSError>>
where Self: Sized + Message { ... }
unsafe fn valuesForAttributes_forItemWithURL_completion(
&self,
attributes: &NSArray<NSURLResourceKey>,
item_url: &NSURL,
completion: &DynBlock<dyn Fn(NonNull<NSDictionary<NSURLResourceKey, AnyObject>>, *mut NSError)>,
)
where Self: Sized + Message { ... }
}Expand description
The group of methods to implement for modifying the Finder user interface to express file synchronization status and control.
See also Apple’s documentation
Provided Methods§
Available on crate feature objc2-app-kit only.
objc2-app-kit only.Requests a custom menu from the extension.
Override this method to provide custom menus in the Finder. You can
customize this menu based both on the menu’s kind and on the selected and
targeted items (if any). You can get the selected and targeted items from
the extension’s FIFinderSyncController.
If kind is FIMenuKindToolbarItemMenu, the system always calls this
method even if the target and selection are not related to the extension.
The extension’s principal object provides a method for each menu item’s assigned action.
-
Parameters:
-
menu: The type of menu being displayed. For a list of possible values, see
FinderSync/FIMenuKind. -
Returns: A custom menu.
§See Also
FinderSync/FIFinderSyncController/targetedURLFinderSync/FIFinderSyncController/selectedItemURLs
Sourceunsafe fn beginObservingDirectoryAtURL(&self, url: &NSURL)
unsafe fn beginObservingDirectoryAtURL(&self, url: &NSURL)
Tells the extension that the user is looking at a monitored directory or at one of its subdirectories.
Override this method to receive notifications when the user opens the
contents of a monitored directory or one of its subdirectories in the
Finder. The system calls beginObservingDirectoryAtURL: only once for each
unique URL. As long as the content remains visible in at least one Finder
window, any additional Finder windows that open to the same URL are ignored.
-
Note: The system creates additional instances of your extension for any Open and Save dialogs. These extensions receive their own calls to
beginObservingDirectoryAtURL:, even if the directory is already open in a Finder window. -
Parameters:
-
url: The URL of the directory.
Sourceunsafe fn endObservingDirectoryAtURL(&self, url: &NSURL)
unsafe fn endObservingDirectoryAtURL(&self, url: &NSURL)
Tells the extension that the user has stopped looking at a monitored directory or at one of its subdirectories.
Override this method to receive notifications when the user is no longer
looking at the contents of the given URL. As with
FIFinderSync/beginObservingDirectoryAtURL:, the Open and Save
dialogs are tracked separately from the Finder.
- Parameters:
- url: The URL of the directory.
Sourceunsafe fn requestBadgeIdentifierForURL(&self, url: &NSURL)
unsafe fn requestBadgeIdentifierForURL(&self, url: &NSURL)
Requests a badge for the given file or directory.
Override this method to receive notifications whenever a new item becomes
visible in the Finder. Check the item’s state, and call
FIFinderSyncController/setBadgeIdentifier:forURL: to set an appropriate
badge.
- Parameters:
- url: The URL of a file or directory inside the extension’s monitored directories.
§See Also
FinderSync/FIFinderSyncController/setBadgeIdentifier:forURL:
Sourceunsafe fn toolbarItemName(&self) -> Retained<NSString>
unsafe fn toolbarItemName(&self) -> Retained<NSString>
The name of the extension’s toolbar button.
To add a toolbar item to the Finder, override the getter method for the toolbar image, name, and tooltip properties.
Sourceunsafe fn toolbarItemImage(&self) -> Retained<NSImage>
Available on crate feature objc2-app-kit only.
unsafe fn toolbarItemImage(&self) -> Retained<NSImage>
objc2-app-kit only.The image for the extension’s toolbar button.
To add a toolbar item to the Finder, override the getter method for the toolbar image, name, and tooltip properties.
Sourceunsafe fn toolbarItemToolTip(&self) -> Retained<NSString>
unsafe fn toolbarItemToolTip(&self) -> Retained<NSString>
The tooltip text for the extension’s toolbar button.
To add a toolbar item to the Finder, override the getter method for the toolbar image, name, and tooltip properties.
unsafe fn supportedServiceNamesForItemWithURL( &self, item_url: &NSURL, ) -> Retained<NSArray<NSFileProviderServiceName>>
unsafe fn makeListenerEndpointForServiceName_itemURL_andReturnError( &self, service_name: &NSFileProviderServiceName, item_url: &NSURL, ) -> Result<Retained<NSXPCListenerEndpoint>, Retained<NSError>>
unsafe fn valuesForAttributes_forItemWithURL_completion( &self, attributes: &NSArray<NSURLResourceKey>, item_url: &NSURL, completion: &DynBlock<dyn Fn(NonNull<NSDictionary<NSURLResourceKey, AnyObject>>, *mut NSError)>, )
block2 only.