PeasExtension

PeasExtension — Proxy for extensions.

Synopsis

typedef             PeasExtension;
GType               peas_extension_get_extension_type   (PeasExtension *exten);
gboolean            peas_extension_call                 (PeasExtension *exten,
                                                         const gchar *method_name,
                                                         ...);
gboolean            peas_extension_call_valist          (PeasExtension *exten,
                                                         const gchar *method_name,
                                                         va_list args);
gboolean            peas_extension_callv                (PeasExtension *exten,
                                                         const gchar *method_name,
                                                         GIArgument *args,
                                                         GIArgument *return_value);

Description

PeasExtension is a proxy class used to access actual extensions implemented using various languages. As such, the application writer will use PeasExtension instances to call methods on extension provided by loaded plugins.

To properly use the proxy instances, you will need GObject-introspection data for the GInterface or GObjectClass you want to use as an extension point. For instance, if you wish to use PeasActivatable, you will need to put the following code excerpt in the engine initialization code, in order to load the required "Peas" typelib:

1
2
g_irepository_require (g_irepository_get_default (),
                       "Peas", "1.0", 0, NULL);

You should proceed the same way for any namespace which provides interfaces you want to use as extension points. GObject-introspection data is required for all the supported languages, even for C.

PeasExtension does not provide any way to access the underlying object. The main reason is that some loaders may not rely on proper GObject inheritance for the definition of extensions, and hence it would not be possible for libpeas to provide a functional GObject instance at all. Another reason is that it makes reference counting issues easier to deal with.

See peas_extension_call() for more information.

Details

PeasExtension

typedef GObject PeasExtension;

A proxy class to access the actual plugin.


peas_extension_get_extension_type ()

GType               peas_extension_get_extension_type   (PeasExtension *exten);

Warning

peas_extension_get_extension_type is deprecated and should not be used in newly-written code. 1.2.

Get the type of the extension interface of the object proxied by exten.

exten :

A PeasExtension.

Returns :

The GType proxied by exten.

peas_extension_call ()

gboolean            peas_extension_call                 (PeasExtension *exten,
                                                         const gchar *method_name,
                                                         ...);

Warning

peas_extension_call has been deprecated since version 1.2 and should not be used in newly-written code. Use the dynamically implemented interface instead.

Call a method of the object behind extension.

The arguments provided to this functions should be of the same type as those defined in the GInterface or GObjectClass used as a base for the proxied extension. They should be provided in the same order, and if its return type is not void, then a pointer to a variable of that type should be passed as the last argument.

For instance, if the method prototype is:

1
gint (*my_method) (MyClass *instance, const gchar *str, SomeObject *obj);

you should call peas_extension_call() this way:

1
peas_extension_call (extension, "my_method", "some_str", obj, &gint_var);

This function will not do anything if the introspection data for the proxied object's class has not been loaded previously through g_irepository_require().

exten :

A PeasExtension.

method_name :

the name of the method that should be called.

... :

arguments for the method.

Returns :

TRUE on successful call.

peas_extension_call_valist ()

gboolean            peas_extension_call_valist          (PeasExtension *exten,
                                                         const gchar *method_name,
                                                         va_list args);

Warning

peas_extension_call_valist has been deprecated since version 1.2 and should not be used in newly-written code. Use the dynamically implemented interface instead.

Call a method of the object behind extension, using args as arguments.

See peas_extension_call() for more information.

exten :

A PeasExtension.

method_name :

the name of the method that should be called.

args :

the arguments for the method.

Returns :

TRUE on successful call.

peas_extension_callv ()

gboolean            peas_extension_callv                (PeasExtension *exten,
                                                         const gchar *method_name,
                                                         GIArgument *args,
                                                         GIArgument *return_value);

Warning

peas_extension_callv has been deprecated since version 1.2 and should not be used in newly-written code. Use the dynamically implemented interface instead.

Call a method of the object behind extension, using args as arguments.

See peas_extension_call() for more information.

exten :

A PeasExtension.

method_name :

the name of the method that should be called.

args :

the arguments for the method.

return_value :

the return falue for the method.

Returns :

TRUE on successful call.

See Also

PeasExtensionSet