Peas.ExtensionSet¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
w/co |
The properties to pass the extensions when creating them |
||
r/w/co |
The |
||
r/w/co |
The extension |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Emitted when a new extension has been added to the |
|
Emitted when a new extension is about to be removed from the |
Fields¶
- Inherited:
Class Details¶
- class Peas.ExtensionSet(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
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:
engine (
Peas.Engine
orNone
) – APeas.Engine
, orNone
.exten_type (
GObject.GType
) – the extensionGObject.GType
.prop_names ([
str
]) – an array of property names.prop_values ([
GObject.Value
]) – an array of property values.
- Returns:
a new instance of
Peas.ExtensionSet
.- Return type:
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:
func (
Peas.ExtensionSetForeachFunc
) – A function call for each extension.data (
object
orNone
) – Optional data to be passed to the function orNone
.
Calls func for each [class`GObject`.Object].
- get_extension(info)¶
- Parameters:
info (
Peas.PluginInfo
) – aPeas.PluginInfo
- Returns:
a reference to a
GObject.Object
- Return type:
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:
- Parameters:
extension_set (
Peas.ExtensionSet
) – The object which received the signalinfo (
Peas.PluginInfo
) – APeas.PluginInfo
.extension (
GObject.Object
) – A #PeasExtension.
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:
- Parameters:
extension_set (
Peas.ExtensionSet
) – The object which received the signalinfo (
Peas.PluginInfo
) – APeas.PluginInfo
.extension (
GObject.Object
) – A #PeasExtension.
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:
- Default Value:
- Flags:
The properties to pass the extensions when creating them
- Peas.ExtensionSet.props.engine¶
- Name:
engine
- Type:
- Default Value:
- Flags:
The
Peas.Engine
this set is attached to
- Peas.ExtensionSet.props.extension_type¶
- Name:
extension-type
- Type:
- Default Value:
<GType void>
- Flags:
The extension
GObject.GType
managed by this set