FIFinderSyncProtocol

Trait FIFinderSyncProtocol 

Source
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§

Source

unsafe fn menuForMenuKind( &self, menu: FIMenuKind, mtm: MainThreadMarker, ) -> Option<Retained<NSMenu>>
where Self: Sized + Message,

Available on crate feature 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/targetedURL
  • FinderSync/FIFinderSyncController/selectedItemURLs
Source

unsafe fn beginObservingDirectoryAtURL(&self, url: &NSURL)
where Self: Sized + Message,

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.

Source

unsafe fn endObservingDirectoryAtURL(&self, url: &NSURL)
where Self: Sized + Message,

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.
Source

unsafe fn requestBadgeIdentifierForURL(&self, url: &NSURL)
where Self: Sized + Message,

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:
Source

unsafe fn toolbarItemName(&self) -> Retained<NSString>
where Self: Sized + Message,

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.

Source

unsafe fn toolbarItemImage(&self) -> Retained<NSImage>
where Self: Sized + Message,

Available on crate feature 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.

Source

unsafe fn toolbarItemToolTip(&self) -> Retained<NSString>
where Self: Sized + Message,

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.

Source

unsafe fn supportedServiceNamesForItemWithURL( &self, item_url: &NSURL, ) -> Retained<NSArray<NSFileProviderServiceName>>
where Self: Sized + Message,

Source

unsafe fn makeListenerEndpointForServiceName_itemURL_andReturnError( &self, service_name: &NSFileProviderServiceName, item_url: &NSURL, ) -> Result<Retained<NSXPCListenerEndpoint>, Retained<NSError>>
where Self: Sized + Message,

Source

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,

Available on crate feature block2 only.

Trait Implementations§

Source§

impl ProtocolType for dyn FIFinderSyncProtocol

Source§

const NAME: &'static str = "FIFinderSync"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn FIFinderSyncProtocol

Implementations on Foreign Types§

Source§

impl<T> FIFinderSyncProtocol for ProtocolObject<T>

Implementors§