GfPlugin

GfPlugin — GfPlugin Object API

Synopsis




            GfPlugin;
const GfPluginInfo* (*GfPluginQueryFunc)    (GTypeModule *module);
gboolean    (*GfPluginRegisterFunc)         (GTypeModule *module);
enum        GfPluginState;
GfPlugin*   gf_plugin_new                   (const gchar *filename);
void        gf_plugin_set_filename          (GfPlugin *plugin,
                                             const gchar *filename);
const gchar* gf_plugin_get_filename         (const GfPlugin *plugin);
GModule*    gf_plugin_get_module            (const GfPlugin *plugin);
gboolean    gf_plugin_query_plugin          (GfPlugin *plugin);
#define     gf_plugin_state_to_string       (state, i18n)
#define     gf_plugin_state_from_string     (str)
GType*      gf_plugin_get_registered_types  (const GfPlugin *plugin,
                                             guint *n_types);
#define     GF_PLUGIN_ABI_VERSION

Description

GfPlugin is the base class for all plugins in Guifications.

Details

GfPlugin

typedef struct {
	GTypeModule parent;

	GfPluginPriv *priv;

    void (*_gf_reserved1)(void);
    void (*_gf_reserved2)(void);
    void (*_gf_reserved3)(void);
    void (*_gf_reserved4)(void);
} GfPlugin;

GfPlugin is an opaque structure and should not be used directly.


GfPluginQueryFunc ()

const GfPluginInfo* (*GfPluginQueryFunc)    (GTypeModule *module);

The signature of the query function a GfPlugin must implement. In the plugin, the function must be called gf_plugin_query().

module : The GfPlugin responsible for this plugin.
Returns : The GfPluginInfo for the plugin.

GfPluginRegisterFunc ()

gboolean    (*GfPluginRegisterFunc)         (GTypeModule *module);

The signature of the register function that a GfPlugin must implement. In the plugin the function must be name gf_plugin_register().

When this function is called, the plugin should register all of it's types with module.

module : The GfPlugin responsible for this plugin.
Returns : TRUE on success.

enum GfPluginState

typedef enum {
	GF_PLUGIN_STATE_ERROR = 0,
	GF_PLUGIN_STATE_LOADED,
	GF_PLUGIN_STATE_LOAD_FAILED,
	GF_PLUGIN_STATE_NOT_LOADED
} GfPluginState;

Possible states that a plugin could be in.

GF_PLUGIN_STATE_ERROR Missing register function or some other error.
GF_PLUGIN_STATE_LOADED An instance of a type inplemented by this plugin is allocated.
GF_PLUGIN_STATE_LOAD_FAILED Register function return FALSE.
GF_PLUGIN_STATE_NOT_LOADED There are no instances allocated of the types implemented by this plugin.

gf_plugin_new ()

GfPlugin*   gf_plugin_new                   (const gchar *filename);

Loads filename as a GfPlugin and returns it.

filename : The filename to load.
Returns : The new GfPlugin or NULL on error.

gf_plugin_set_filename ()

void        gf_plugin_set_filename          (GfPlugin *plugin,
                                             const gchar *filename);

Sets the filename for plugin.

plugin : The GfPlugin instance.
filename : The new filename.

gf_plugin_get_filename ()

const gchar* gf_plugin_get_filename         (const GfPlugin *plugin);

Gets the filename for plugin.

plugin : The GfPlugin instance.
Returns : The filename for plugin.

gf_plugin_get_module ()

GModule*    gf_plugin_get_module            (const GfPlugin *plugin);

Gets the GModule instance used for plugin.

plugin : The GfPlugin instance.
Returns : The GModule instance.

gf_plugin_query_plugin ()

gboolean    gf_plugin_query_plugin          (GfPlugin *plugin);

Quereries plugin for it's meta data.

plugin : The GfPlugin instance.
Returns : TRUE on success or FALSE on error.

gf_plugin_state_to_string()

#define     gf_plugin_state_to_string(state, i18n)

Gets a string from a GfPluginState.

state : The GfPluginState.
i18n : TRUE for the translated version.
Returns : state as a string.

gf_plugin_state_from_string()

#define     gf_plugin_state_from_string(str)

Gets a GfPluginState from a string.

Note: str MUST be the untranslated string!

str : The String.
Returns : The GfPluginState.

gf_plugin_get_registered_types ()

GType*      gf_plugin_get_registered_types  (const GfPlugin *plugin,
                                             guint *n_types);

plugin : The GfPlugin instance.
n_types : Optional guint pointer to contain the number of registered types.
Returns : a newly allocated array of GType of the types registered in plugin. Return Value : A newly allocated array of GType that must be freed with #gfree().

GF_PLUGIN_ABI_VERSION

#define GF_PLUGIN_ABI_VERSION		0x0001

The current ABI version for gflib-plugin.