Plugin Interface

Plugin Interface — The plugin interface that all plugins must implement.

Functions

Properties

GError * error Read / Write
char * filename Read / Write / Construct Only
GPluginPluginInfo * info Read / Write / Construct Only
GPluginLoader * loader Read / Write / Construct Only
GPluginPluginState state Read / Write / Construct

Signals

void state-changed Run Last

Types and Values

Object Hierarchy

    GInterface
    ╰── GPluginPlugin

Description

GPluginPlugin is an interface that defines the behavior of plugins. It is implemented by each loader which add additional data for their implementation.

Functions

gplugin_plugin_get_filename ()

gchar *
gplugin_plugin_get_filename (GPluginPlugin *plugin);

Returns the filename that plugin was loaded from.

Parameters

plugin

The GPluginPlugin instance.

 

Returns

The filename of plugin .

[transfer full]


gplugin_plugin_get_loader ()

GPluginLoader *
gplugin_plugin_get_loader (GPluginPlugin *plugin);

Returns the GPluginLoader that loaded plugin .

Parameters

plugin

The GPluginPlugin instance.

 

Returns

The GPluginLoader that loaded plugin .

[transfer full]


gplugin_plugin_get_info ()

GPluginPluginInfo *
gplugin_plugin_get_info (GPluginPlugin *plugin);

Returns the GPluginPluginInfo for plugin .

Parameters

plugin

The GPluginPlugin instance.

 

Returns

The GPluginPluginInfo instance for plugin .

[transfer full]


gplugin_plugin_get_state ()

GPluginPluginState
gplugin_plugin_get_state (GPluginPlugin *plugin);

Gets the current state of plugin .

Parameters

plugin

The GPluginPlugin instance.

 

Returns

The current state of plugin .

[transfer full]


gplugin_plugin_set_state ()

void
gplugin_plugin_set_state (GPluginPlugin *plugin,
                          GPluginPluginState state);

Changes the state of plugin to state . This function should only be called by loaders.

Parameters

plugin

The GPluginPlugin instance.

 

state

A new GPluginPluginState for plugin .

 

gplugin_plugin_get_error ()

GError *
gplugin_plugin_get_error (GPluginPlugin *plugin);

Gets the GError, if any, that the plugin returned during load or unload.

Parameters

plugin

The GPluginPlugin instance.

 

Returns

The GError the plugin returned during load or unload, or NULL if no error occurred.

[transfer full]

Types and Values

enum GPluginPluginState

The known states of a plugin.

Members

GPLUGIN_PLUGIN_STATE_UNKNOWN

The state of the plugin is unknown.

 

GPLUGIN_PLUGIN_STATE_ERROR

There was an error loading or unloading the plugin.

 

GPLUGIN_PLUGIN_STATE_QUERIED

The plugin has been queried but not loaded.

 

GPLUGIN_PLUGIN_STATE_REQUERY

The plugin should be requeried.

 

GPLUGIN_PLUGIN_STATE_LOADED

The plugin is loaded.

 

GPLUGIN_PLUGIN_STATE_LOAD_FAILED

The plugin failed to load.

 

GPLUGIN_PLUGIN_STATE_UNLOAD_FAILED

The plugin failed to unload.

 

GPLUGIN_TYPE_PLUGIN

#define GPLUGIN_TYPE_PLUGIN (gplugin_plugin_get_type())

The standard _get_type macro for GPluginPlugin.


struct GPluginPluginInterface

struct GPluginPluginInterface {
	void (*state_changed)(
		GPluginPlugin *plugin,
		GPluginPluginState oldstate,
		GPluginPluginState newstate);
};

The interface that defines the behavior of plugins, including properties and signals.

Members

state_changed ()

The class closure for the “state-changed” signal.

 

GPluginPlugin

typedef struct _GPluginPlugin GPluginPlugin;

GPluginPlugin is an opaque data structure and should not be used directly.

Property Details

The “error” property

  “error”                    GError *

A GError returned the plugin if it failed to load or unload.

Owner: GPluginPlugin

Flags: Read / Write


The “filename” property

  “filename”                 char *

The absolute path to the plugin on disk.

Owner: GPluginPlugin

Flags: Read / Write / Construct Only

Default value: NULL


The “info” property

  “info”                     GPluginPluginInfo *

The GPluginPluginInfo from this plugin.

Owner: GPluginPlugin

Flags: Read / Write / Construct Only


The “loader” property

  “loader”                   GPluginLoader *

The GPluginLoader that loaded this plugin.

Owner: GPluginPlugin

Flags: Read / Write / Construct Only


The “state” property

  “state”                    GPluginPluginState

The GPluginPluginState that this plugin is in.

Owner: GPluginPlugin

Flags: Read / Write / Construct

Default value: GPLUGIN_PLUGIN_STATE_UNKNOWN

Signal Details

The “state-changed” signal

void
user_function (GPluginPlugin     *plugin,
               GPluginPluginState oldstate,
               GPluginPluginState newstate,
               gpointer           user_data)

Emitted when plugin changes state.

Parameters

plugin

The GPluginPlugin that changed states.

 

oldstate

The old GPluginPluginState.

 

newstate

The new state of plugin .

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last