Mac Developer Library

Developer

AddressBook Framework Reference Address Book Actions Reference

Options
Deployment Target:

On This Page

Address Book Actions Reference

The Address Book action callbacks allow you to populate the rollover menus of the Address Book application with custom items. You do this by writing an Address Book action plug-in that implements a function named ABActionRegisterCallbacks. This function registers a set of callback functions that are invoked by Address Book. The plug-in’s CFBundle must also implement the callback functions.

This is an example implementation of the ABActionRegisterCallbacks function:

  • ABActionCallbacks* ABActionRegisterCallbacks(void)
  • {
  • ABActionCallbacks *callbacks;
  • callbacks = malloc(sizeof(ABActionCallbacks));
  • if (callbacks == NULL)
  • return NULL;
  • callbacks->version = 0;
  • callbacks->property = actionProperty;
  • callbacks->title = actionTitle;
  • callbacks->enabled = actionEnabled;
  • callbacks->selected = actionSelected;
  • return callbacks;
  • }

Each action plug-in can implement only one action. Actions can only apply to items with labels.

Use Xcode to create Address Book action plug-ins. Place action plug-ins in ~/Library/Address Book Plug-Ins or /Library/Address Book Plug-Ins, depending on the scope you want for the action.

Callbacks

  • Return the title of the menu item for the action. If the property returned by ABActionGetPropertyCallback is a multi-value property, identifier contains the unique identifier of the value selected.

    Declaration

    Objective-C

    typedef CFStringRef (*ABActionCopyTitleCallback) ( ABPersonRef person, CFString CFStringRef identifier );

    Import Statement

    Availability

    Available in OS X v10.3 and later.

  • Return true if the action menu item should be enabled, false otherwise. If the property returned by ABActionGetPropertyCallback is a multi-value property, identifier contains the unique identifier of the value selected.

    Declaration

    Objective-C

    typedef Boolean (*ABActionEnabledCallback) ( ABPersonRef person, CFStringRef identifier );

    Import Statement

    Availability

    Available in OS X v10.3 and later.

  • Return the property the action applies to.

    Declaration

    Objective-C

    typedef CFStringRef (* ABActionGetPropertyCallback ) (void);

    Import Statement

    Availability

    Available in OS X v10.3 and later.

  • Execute the action. If the property returned by ABActionGetPropertyCallback is a multi-value property, identifier contains the unique identifier of the value selected; otherwise, identifier is NULL.

    Declaration

    Objective-C

    typedef void (*ABActionSelectedCallback) ( ABPersonRef person, CFStringRef identifier );

    Import Statement

    Availability

    Available in OS X v10.3 and later.

Data Types