## EPlugin EPlugin |

## Synopsis

    #define             E_PLUGIN_CLASSID
    struct              EPluginAuthor;
    enum                EPluginFlags;
    struct              EPlugin;
    gint                e_plugin_construct                  (EPlugin *plugin,
                                                             xmlNodePtr root);
    gint                e_plugin_load_plugins               (void);
    GSList *            e_plugin_list_plugins               (void);
    gpointer            e_plugin_get_symbol                 (EPlugin *plugin,
                                                             const gchar *name);
    gpointer            e_plugin_invoke                     (EPlugin *plugin,
                                                             const gchar *name,
                                                             gpointer data);
    void                e_plugin_enable                     (EPlugin *plugin,
                                                             gint state);
    GtkWidget *         e_plugin_get_configure_widget       (EPlugin *plugin);
    gchar *             e_plugin_xml_prop                   (xmlNodePtr node,
                                                             const gchar *id);
    gchar *             e_plugin_xml_prop_domain            (xmlNodePtr node,
                                                             const gchar *id,
                                                             const gchar *domain);
    gint                e_plugin_xml_int                    (xmlNodePtr node,
                                                             const gchar *id,
                                                             gint def);
    gchar *             e_plugin_xml_content                (xmlNodePtr node);
    gchar *             e_plugin_xml_content_domain         (xmlNodePtr node,
                                                             const gchar *domain);
    struct              EPluginHook;
    struct              EPluginHookTargetMap;
    struct              EPluginHookTargetKey;
    EPluginHook *       e_plugin_hook_new                   (EPlugin *plugin,
                                                             xmlNodePtr root);
    void                e_plugin_hook_enable                (EPluginHook *plugin_hook,
                                                             gint state);
    guint32             e_plugin_hook_mask                  (xmlNodePtr root,
                                                             const EPluginHookTargetKey *map,
                                                             const gchar *prop);
    guint32             e_plugin_hook_id                    (xmlNodePtr root,
                                                             const EPluginHookTargetKey *map,
                                                             const gchar *prop);

## Object Hierarchy

      GObject
       +----EPlugin

      GObject
       +----EPluginHook
             +----EConfigHook
             +----EEventHook
             +----EImportHook
             +----EPluginUIHook

## Properties

      "enabled"                  gboolean              : Read / Write

## Description

## Details

### E_PLUGIN_CLASSID

    #define E_PLUGIN_CLASSID "org.gnome.evolution.plugin"

### struct EPluginAuthor

    struct EPluginAuthor {
    	gchar *name;
    	gchar *email;
    };

### enum EPluginFlags

    typedef enum {
    	E_PLUGIN_FLAGS_SYSTEM_PLUGIN = 1 << 0
    } EPluginFlags;

`E_PLUGIN_FLAGS_SYSTEM_PLUGIN` |

### struct EPlugin

    struct EPlugin;

### e_plugin_construct ()

    gint                e_plugin_construct                  (EPlugin *plugin,
                                                             xmlNodePtr root);

Helper to invoke the construct virtual method.

`plugin` : | an EPlugin
`root` : | The XML root node of the sub-tree containing the plugin definition.
Returns : | The return from the construct virtual method.

### e_plugin_load_plugins ()

    gint                e_plugin_load_plugins               (void);

Scan the search path, looking for plugin definitions, and load them into memory.

Returns : | Returns -1 if an error occurred.

### e_plugin_list_plugins ()

    GSList *            e_plugin_list_plugins               (void);

### e_plugin_get_symbol ()

    gpointer            e_plugin_get_symbol                 (EPlugin *plugin,
                                                             const gchar *name);

Helper to fetch a symbol name from a plugin.

`plugin` : | an EPlugin
`name` : | The name of the symbol to fetch. The format of this name will depend on the EPlugin type and its language conventions.
Returns : | the symbol value, or `NULL` if not found

### e_plugin_invoke ()

    gpointer            e_plugin_invoke                     (EPlugin *plugin,
                                                             const gchar *name,
                                                             gpointer data);

Helper to invoke the invoke virtual method.

`plugin` : | an EPlugin
`name` : | The name of the function to invoke. The format of this name will depend on the EPlugin type and its language conventions.
`data` : | The argument to the function. Its actual type depends on the hook on which the function resides. It is up to the called function to get this right.
Returns : | The return of the plugin invocation.

### e_plugin_enable ()

    void                e_plugin_enable                     (EPlugin *plugin,
                                                             gint state);

Set the enable state of a plugin.

THIS IS NOT FULLY IMPLEMENTED YET

`plugin` : | an EPlugin
`state` : | `TRUE` to enable, `FALSE` to disable

### e_plugin_get_configure_widget ()

    GtkWidget *         e_plugin_get_configure_widget       (EPlugin *plugin);

Plugin itself should have implemented "e_plugin_lib_get_configure_widget" function * of prototype EPluginLibGetConfigureWidgetFunc.

`plugin` : | an EPlugin
Returns : | Configure widget or `NULL`

### e_plugin_xml_prop ()

    gchar *             e_plugin_xml_prop                   (xmlNodePtr node,
                                                             const gchar *id);

A static helper function to look up a property on an XML node, and ensure it is allocated in GLib system memory.

`node` : | An XML node.
`id` : | The name of the property to retrieve.
Returns : | The property, allocated in GLib memory, or NULL if no such property exists.

### e_plugin_xml_prop_domain ()

    gchar *             e_plugin_xml_prop_domain            (xmlNodePtr node,
                                                             const gchar *id,
                                                             const gchar *domain);

A static helper function to look up a property on an XML node, and translate it based on `domain`.

`node` : | An XML node.
`id` : | The name of the property to retrieve.
`domain` : | The translation domain for this string.
Returns : | The property, allocated in GLib memory, or NULL if no such property exists.

### e_plugin_xml_int ()

    gint                e_plugin_xml_int                    (xmlNodePtr node,
                                                             const gchar *id,
                                                             gint def);

A static helper function to look up a property on an XML node as an integer. If the property doesn't exist, then `def` is returned as a default value instead.

`node` : | An XML node.
`id` : | The name of the property to retrieve.
`def` : | A default value if the property doesn't exist. Can be used to determine if the property isn't set.
Returns : | The value if set, or `def` if not.

### e_plugin_xml_content ()

    gchar *             e_plugin_xml_content                (xmlNodePtr node);

A static helper function to retrieve the entire textual content of an XML node, and ensure it is allocated in GLib system memory. If GLib isn't using the system malloc them it must copy the content.

Returns : | The node content, allocated in GLib memory.

### e_plugin_xml_content_domain ()

    gchar *             e_plugin_xml_content_domain         (xmlNodePtr node,
                                                             const gchar *domain);

A static helper function to retrieve the entire textual content of an XML node, and ensure it is allocated in GLib system memory. If GLib isn't using the system malloc them it must copy the content.

Returns : | The node content, allocated in GLib memory.

### struct EPluginHook

    struct EPluginHook;

### struct EPluginHookTargetMap

    struct EPluginHookTargetMap {
    	const gchar *type;
    	gint id;
    	const EPluginHookTargetKey *mask_bits; /* null terminated array */
    };

### struct EPluginHookTargetKey

    struct EPluginHookTargetKey {
    	const gchar *key;
    	guint32 value;
    };

### e_plugin_hook_new ()

    EPluginHook *       e_plugin_hook_new                   (EPlugin *plugin,
                                                             xmlNodePtr root);

### e_plugin_hook_enable ()

    void                e_plugin_hook_enable                (EPluginHook *plugin_hook,
                                                             gint state);

Set the enabled state of the plugin hook. This is called by the plugin code.

THIS IS NOT FULY IMEPLEMENTED YET

### e_plugin_hook_mask ()

    guint32             e_plugin_hook_mask                  (xmlNodePtr root,
                                                             const EPluginHookTargetKey *map,
                                                             const gchar *prop);

This is a static helper function which looks up a property `prop` on the XML node `root`, and then uses the `map` table to convert it into a bitmask. The property value is a comma separated list of enumeration strings which are indexed into the `map` table.

`root` : | An XML node.
`map` : | A zero-fill terminated array of EPluginHookTargeKeys used to map a string with a bit value.
`prop` : | The property name.
Returns : | A bitmask representing the inclusive-or of all of the integer values of the corresponding string id's stored in the `map`.

### e_plugin_hook_id ()

    guint32             e_plugin_hook_id                    (xmlNodePtr root,
                                                             const EPluginHookTargetKey *map,
                                                             const gchar *prop);

This is a static helper function which looks up a property `prop` on the XML node `root`, and then uses the `map` table to convert it into an integer.

This is used as a helper wherever you need to represent an enumerated value in the XML.

Returns : | If the `prop` value is in `map`, then the corresponding integer value, if not, then ~0.

## Property Details

### The `"enabled"` property

      "enabled"                  gboolean              : Read / Write

Whether the plugin is enabled.

Default value: TRUE