Peas.ExtensionSet

g GObject.GInterface GObject.GInterface Gio.ListModel Gio.ListModel GObject.GInterface->Gio.ListModel GObject.Object GObject.Object Peas.ExtensionSet Peas.ExtensionSet GObject.Object->Peas.ExtensionSet Gio.ListModel->Peas.ExtensionSet

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gio.ListModel (4)

Structs:

GObject.ObjectClass (5)

class

new (engine, exten_type, prop_names, prop_values)

foreach (func, *data)

get_extension (info)

Virtual Methods

Inherited:

GObject.Object (7), Gio.ListModel (3)

Properties

Name

Type

Flags

Short Description

construct-properties

int

w/co

The properties to pass the extensions when creating them

engine

Peas.Engine

r/w/co

The Peas.Engine this set is attached to

extension-type

GObject.GType

r/w/co

The extension GObject.GType managed by this set

Signals

Inherited:

GObject.Object (1), Gio.ListModel (1)

Name

Short Description

extension-added

Emitted when a new extension has been added to the Peas.ExtensionSet.

extension-removed

Emitted when a new extension is about to be removed from the Peas.ExtensionSet.

Fields

Inherited:

GObject.Object (1), Gio.ListModel (1)

Class Details

class Peas.ExtensionSet(**kwargs)
Bases:

GObject.Object, Gio.ListModel

Abstract:

No

Structure:

Peas.ExtensionSetClass

Proxy for a set of extensions of the same type.

A Peas.ExtensionSet is an object which proxies method calls to a set of actual extensions. The application writer will use these objects in order to call methods on several instances of an actual extension exported by all the currently loaded plugins.

Peas.ExtensionSet will automatically track loading and unloading of the plugins, and signal appearance and disappearance of new extension instances. You should connect to those signals if you wish to call specific methods on loading or unloading time.

Here is the code for a typical setup of Peas.ExtensionSet with ExampleActivatable as the watched extension point, and GtkWindow instances as the target objects:

```c static void on_extension_added (Peas.ExtensionSet *set, Peas.PluginInfo *info, ExampleActivatable *activatable) { example_activatable_activate (activatable); }

static void on_extension_removed (Peas.ExtensionSet *set, Peas.PluginInfo *info, ExampleActivatable *activatable) { example_activatable_deactivate (activatable); }

Peas.ExtensionSet * setup_extension_set (Peas.Engine *engine, GtkWindow *window) { Peas.ExtensionSet *set;

set = Peas.ExtensionSet.new (engine, EXAMPLE_TYPE_ACTIVATABLE, “object”, window, None); Peas.ExtensionSet.foreach (set, (Peas.ExtensionSetForeachFunc) on_extension_added, None); g_signal_connect (set, “extension-added”, G_CALLBACK (on_extension_added), None); g_signal_connect (set, “extension-removed”, G_CALLBACK (on_extension_removed), None); return set; } ```

classmethod new(engine, exten_type, prop_names, prop_values)
Parameters:
Returns:

a new instance of Peas.ExtensionSet.

Return type:

Peas.ExtensionSet

Create a new Peas.ExtensionSet for the exten_type extension type.

If engine is None, then the default engine will be used.

See [ctor`ExtensionSet`.new] for more information.

foreach(func, *data)
Parameters:

Calls func for each [class`GObject`.Object].

get_extension(info)
Parameters:

info (Peas.PluginInfo) – a Peas.PluginInfo

Returns:

a reference to a GObject.Object

Return type:

GObject.Object or None

Returns the [class`GObject`.Object] object corresponding to info.

If the plugin doesn’t provide such an extension, it returns None.

Signal Details

Peas.ExtensionSet.signals.extension_added(extension_set, info, extension)
Signal Name:

extension-added

Flags:

RUN_LAST

Parameters:

Emitted when a new extension has been added to the Peas.ExtensionSet.

It happens when a new plugin implementing the extension set’s extension type is loaded.

You should connect to this signal in order to set up the extensions when they are loaded. Note that this signal is not fired for extensions coming from plugins that were already loaded when the Peas.ExtensionSet instance was created. You should set those up by yourself.

Peas.ExtensionSet.signals.extension_removed(extension_set, info, extension)
Signal Name:

extension-removed

Flags:

RUN_LAST

Parameters:

Emitted when a new extension is about to be removed from the Peas.ExtensionSet.

It happens when a plugin implementing the extension set’s extension type is unloaded, or when the Peas.ExtensionSet itself is destroyed.

You should connect to this signal in order to clean up the extensions when their plugin is unload. Note that this signal is not fired for the [class`GObject`.Object] instances still available when the Peas.ExtensionSet instance is destroyed. You should clean those up by yourself.

Property Details

Peas.ExtensionSet.props.construct_properties
Name:

construct-properties

Type:

int

Default Value:

None

Flags:

WRITABLE, CONSTRUCT_ONLY

The properties to pass the extensions when creating them

Peas.ExtensionSet.props.engine
Name:

engine

Type:

Peas.Engine

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The Peas.Engine this set is attached to

Peas.ExtensionSet.props.extension_type
Name:

extension-type

Type:

GObject.GType

Default Value:

<GType void>

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The extension GObject.GType managed by this set