![]() |
![]() |
![]() |
Peas Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties | Signals |
PeasExtensionSet; PeasExtensionSetClass; PeasParameterArray; gboolean peas_extension_set_call (PeasExtensionSet *set
,const gchar *method_name
,...
); gboolean peas_extension_set_call_valist (PeasExtensionSet *set
,const gchar *method_name
,va_list args
); PeasExtension * peas_extension_set_get_extension (PeasExtensionSet *set
,PeasPluginInfo *info
); PeasExtensionSet * peas_extension_set_new (PeasEngine *engine
,GType exten_type
,const gchar *first_property
,...
); PeasExtensionSet * peas_extension_set_newv (PeasEngine *engine
,GType exten_type
,guint n_parameters
,GParameter *parameters
); PeasExtensionSet * peas_extension_set_new_valist (PeasEngine *engine
,GType exten_type
,const gchar *first_property
,va_list var_args
);
"construct-properties" gpointer : Write / Construct Only "engine" PeasEngine* : Read / Write / Construct Only "extension-type" GType* : Read / Write / Construct Only
A PeasExtensionSet 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.
PeasExtensionSet 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 PeasExtensionSet with PeasActivatable as the watched extension point, and GtkWindow instances as the target objects:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
static void on_extension_added (PeasExtensionSet *set, PeasPluginInfo *info, PeasExtension *exten, GtkWindow *window) { peas_extension_call (exten, "activate", window); } static void on_extension_removed (PeasExtensionSet *set, PeasPluginInfo *info, PeasExtension *exten, GtkWindow *window) { peas_extension_call (exten, "deactivate", window); } static gboolean on_delete_event (GtkWidget *window, GdkEvent *event, PeasExtensionSet *set) { peas_extension_set_call (set, "deactivate"); return FALSE; } PeasExtensionSet * setup_extension_set (PeasEngine *engine, GtkWindow *window) { PeasExtensionSet *set; set = peas_extension_set_new (engine, PEAS_TYPE_ACTIVATABLE, "object", window, NULL); peas_extension_set_call (set, "activate"); g_signal_connect (set, "extension-added", G_CALLBACK (on_extension_added), window); g_signal_connect (set, "extension-removed", G_CALLBACK (on_extension_removed), window); g_signal_connect (window, "delete-event", G_CALLBACK (on_delete_event), set); return set; } |
typedef struct _PeasExtensionSet PeasExtensionSet;
The PeasExtensionSet structure contains only private data and should only be accessed using the provided API.
typedef struct { GObjectClass parent_class; /* Virtual public methods */ gboolean (*call) (PeasExtensionSet *set, const gchar *method, va_list args); /* Signals */ void (*extension_added) (PeasExtensionSet *set, PeasPluginInfo *info, PeasExtension *exten); void (*extension_removed) (PeasExtensionSet *set, PeasPluginInfo *info, PeasExtension *exten); } PeasExtensionSetClass;
typedef struct { guint n_parameters; GParameter *parameters; } PeasParameterArray;
PeasParameterArray is a structure used by the "construct-properties" construct property of PeasExtensionSet.
gboolean peas_extension_set_call (PeasExtensionSet *set
,const gchar *method_name
,...
);
Call a method on all the PeasExtension instances contained in set
.
See peas_extension_call()
for more information.
|
A PeasExtensionSet. |
|
the name of the method that should be called. |
|
arguments for the method. |
Returns : |
TRUE on successful call.
|
gboolean peas_extension_set_call_valist (PeasExtensionSet *set
,const gchar *method_name
,va_list args
);
Call a method on all the PeasExtension instances contained in set
.
See peas_extension_call_valist()
for more information.
|
A PeasExtensionSet. |
|
the name of the method that should be called. |
|
the arguments for the method. |
Returns : |
TRUE on successful call.
|
PeasExtension * peas_extension_set_get_extension (PeasExtensionSet *set
,PeasPluginInfo *info
);
PeasExtensionSet * peas_extension_set_new (PeasEngine *engine
,GType exten_type
,const gchar *first_property
,...
);
Create a new PeasExtensionSet for the exten_type
extension type.
At any moment, the PeasExtensionSet will contain an extension instance for
each loaded plugin which implements the exten_type
extension type. It does
so by connecting to the relevant signals from PeasEngine.
The property values passed to peas_extension_set_new()
will be used for the
construction of new extension instances.
See peas_engine_create_extension()
for more information.
|
A PeasEngine. |
|
the extension GType. |
|
the name of the first property. |
|
the value of the first property, followed optionally by more
name/value pairs, followed by NULL .
|
Returns : |
a new instance of PeasExtensionSet. |
PeasExtensionSet * peas_extension_set_newv (PeasEngine *engine
,GType exten_type
,guint n_parameters
,GParameter *parameters
);
Create a new PeasExtensionSet for the exten_type
extension type.
See peas_extension_set_new()
for more information.
|
A PeasEngine. |
|
the extension GType. |
|
the length of the parameters array.
|
|
an array of GParameter. |
Returns : |
a new instance of PeasExtensionSet. |
PeasExtensionSet * peas_extension_set_new_valist (PeasEngine *engine
,GType exten_type
,const gchar *first_property
,va_list var_args
);
Create a new PeasExtensionSet for the exten_type
extension type.
See peas_extension_set_new()
for more information.
|
A PeasEngine. |
|
the extension GType. |
|
the name of the first property. |
|
the value of the first property, followed optionally by more
name/value pairs, followed by NULL .
|
Returns : |
a new instance of PeasExtensionSet. |
"construct-properties"
property "construct-properties" gpointer : Write / Construct Only
The properties to pass the extensions when creating them.
"engine"
property"engine" PeasEngine* : Read / Write / Construct Only
The PeasEngine this set is attached to.
"extension-added"
signalvoid user_function (PeasExtensionSet *set, PeasPluginInfo *info, PeasExtension *exten, gpointer user_data) : Run Last
The extension-added signal is emitted when a new extension has been added to the PeasExtensionSet. 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 PeasExtensionSet instance was created. You should set those up by yourself.
|
A PeasExtensionSet. |
|
A PeasPluginInfo. |
|
A PeasExtension. |
|
user data set when the signal handler was connected. |
"extension-removed"
signalvoid user_function (PeasExtensionSet *set, PeasPluginInfo *info, PeasExtension *exten, gpointer user_data) : Run Last
The extension-added signal is emitted when a new extension is about to be removed from the PeasExtensionSet. It happens when a plugin implementing the extension set's extension type is unloaded.
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 PeasExtension instances still available when the PeasExtensionSet instance is destroyed. You should clean those up by yourself.
|
A PeasExtensionSet. |
|
A PeasPluginInfo. |
|
A PeasExtension. |
|
user data set when the signal handler was connected. |