OssoABookMenuExtension

OssoABookMenuExtension — Addressbook Menu Extensions

Synopsis

#define             OSSO_ABOOK_DEFINE_MENU_PLUGIN       (TN, t_n, TP, LC, UC)
#define             OSSO_ABOOK_DEFINE_MENU_PLUGIN_SYMBOLS(t_n, LC, UC)
#define             OSSO_ABOOK_MENU_NAME_MAIN_VIEW
#define             OSSO_ABOOK_MENU_NAME_CONTACT_VIEW
#define             OSSO_ABOOK_MENU_NAME_MECARD_VIEW
#define             OSSO_ABOOK_MENU_NAME_SIM_VIEW
                    OssoABookMenuEntry;
                    OssoABookMenuExtension;
int                 osso_abook_menu_extension_get_n_menu_entries
                                                        (OssoABookMenuExtension *extension);
const OssoABookMenuEntry* osso_abook_menu_extension_get_menu_entries
                                                        (OssoABookMenuExtension *extension);
GtkWindow*          osso_abook_menu_extension_get_parent
                                                        (OssoABookMenuExtension *extension);
const char*         osso_abook_menu_extension_get_menu_name
                                                        (OssoABookMenuExtension *extension);
OssoABookContact*   osso_abook_menu_extension_get_contact
                                                        (OssoABookMenuExtension *extension);

Object Hierarchy

  GObject
   +----OssoABookMenuExtension

Properties

  "contact"                  OssoABookContact*     : Read / Write / Construct Only
  "menu-name"                gchar*                : Read / Write / Construct Only
  "parent"                   GtkWindow*            : Read / Write / Construct Only

Description

The addressbook provides a way to add protocol-specific menu items to the 'groups' view. For example, in the addressbook, if you select menu item "Groups", and then select a group (e.g. a google talk account), it will show a window with all of the contacts from that account. If you define a menu extension class and set OssoABookMenuExtensionClass::name to be the same value as the account profile name (in this case "google-talk"), then the menu items returned from osso_abook_menu_extension_get_menu_entries() will be added to the menu for that group view.

Details

OSSO_ABOOK_DEFINE_MENU_PLUGIN()

#define             OSSO_ABOOK_DEFINE_MENU_PLUGIN(TN, t_n, TP, LC, UC)

Registers a class as a menu extension. The arguments TN, t_n, and TP correspond directly to the parameters of G_DEFINE_DYNAMIC_TYPE() (which is called internally)

TN : the name of the new type, in Camel case
t_n : the name of hte new type, in lowercase, with words separated by '_'
TP : the GType of the parent type
LC : code to execute when the module is loaded
UC : code to execute when the module is unloaded

OSSO_ABOOK_DEFINE_MENU_PLUGIN_SYMBOLS()

#define             OSSO_ABOOK_DEFINE_MENU_PLUGIN_SYMBOLS(t_n, LC, UC)

OSSO_ABOOK_MENU_NAME_MAIN_VIEW

#define OSSO_ABOOK_MENU_NAME_MAIN_VIEW          "osso-abook-main-view"

OSSO_ABOOK_MENU_NAME_CONTACT_VIEW

#define OSSO_ABOOK_MENU_NAME_CONTACT_VIEW       "osso-abook-contact-view"

OSSO_ABOOK_MENU_NAME_MECARD_VIEW

#define OSSO_ABOOK_MENU_NAME_MECARD_VIEW        "osso-abook-mecard-view"

OSSO_ABOOK_MENU_NAME_SIM_VIEW

#define OSSO_ABOOK_MENU_NAME_SIM_VIEW           "osso-abook-sim-view"

OssoABookMenuEntry

typedef struct {
        const char      *label;
        unsigned         accel_key;
        GdkModifierType  accel_mods;
        GCallback        callback;
        const char      *name;
} OssoABookMenuEntry;

const char *label; a label for the menu item
GdkModifierType accel_mods; modifier keys to use for the menu item
GCallback callback; a function to call when the menu item is activated
const char *name; the name of the menu item.

OssoABookMenuExtension

typedef struct _OssoABookMenuExtension OssoABookMenuExtension;

Base class for menu extensions. To implement a menu extension, create a class that derives from OssoABookMenuExtension, implement the virtual methods get_n_menu_entries() and get_menu_entries(), and register the extension with OSSO_ABOOK_DEFINE_MENU_PLUGIN()


osso_abook_menu_extension_get_n_menu_entries ()

int                 osso_abook_menu_extension_get_n_menu_entries
                                                        (OssoABookMenuExtension *extension);

extension : a OssoABookMenuExtension
Returns : The number of menu entries provided by the extension.

osso_abook_menu_extension_get_menu_entries ()

const OssoABookMenuEntry* osso_abook_menu_extension_get_menu_entries
                                                        (OssoABookMenuExtension *extension);

extension : a OssoABookMenuExtension
Returns : An array of menu entries.

osso_abook_menu_extension_get_parent ()

GtkWindow*          osso_abook_menu_extension_get_parent
                                                        (OssoABookMenuExtension *extension);

osso_abook_menu_extension_get_menu_name ()

const char*         osso_abook_menu_extension_get_menu_name
                                                        (OssoABookMenuExtension *extension);

Retrieves name of the application menu from which currently activated OssoABookMenuEntry was called.

Examples are OSSO_ABOOK_MENU_NAME_MAIN_VIEW

widget : the widget passed to the OssoABookMenuEntry callback
Returns : The application menu name (e.g. OSSO_ABOOK_MENU_NAME_MAIN_VIEW), or NULL.

osso_abook_menu_extension_get_contact ()

OssoABookContact*   osso_abook_menu_extension_get_contact
                                                        (OssoABookMenuExtension *extension);

Property Details

The "contact" property

  "contact"                  OssoABookContact*     : Read / Write / Construct Only

Contact for which this this extension is created.


The "menu-name" property

  "menu-name"                gchar*                : Read / Write / Construct Only

Name of the menu for which this extension is created.

Default value: NULL


The "parent" property

  "parent"                   GtkWindow*            : Read / Write / Construct Only

Transient parent for extension widgets.