Class
PeasExtensionSet
Description [src]
final class Peas.ExtensionSet : GObject.Object
implements Gio.ListModel {
/* No available fields */
}
Proxy for a set of extensions of the same type.
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
ExampleActivatable as the watched extension point, and GtkWindow
instances as the target objects:
static void
on_extension_added (PeasExtensionSet *set,
PeasPluginInfo *info,
ExampleActivatable *activatable)
{
example_activatable_activate (activatable);
}
static void
on_extension_removed (PeasExtensionSet *set,
PeasPluginInfo *info,
ExampleActivatable *activatable)
{
example_activatable_deactivate (activatable);
}
PeasExtensionSet *
setup_extension_set (PeasEngine *engine,
GtkWindow *window)
{
PeasExtensionSet *set;
set = peas_extension_set_new (engine, EXAMPLE_TYPE_ACTIVATABLE,
"object", window, NULL);
peas_extension_set_foreach (set,
(PeasExtensionSetForeachFunc) on_extension_added,
NULL);
g_signal_connect (set, "extension-added",
G_CALLBACK (on_extension_added), NULL);
g_signal_connect (set, "extension-removed",
G_CALLBACK (on_extension_removed), NULL);
return set;
}
Constructors
peas_extension_set_new_with_properties
Create a new PeasExtensionSet
for the exten_type
extension type.
Instance methods
Methods inherited from GListModel (5)
g_list_model_get_item
Get the item at position
.
g_list_model_get_item_type
Gets the type of the items in list
.
g_list_model_get_n_items
Gets the number of items in list
.
g_list_model_get_object
Get the item at position
.
g_list_model_items_changed
Emits the GListModel::items-changed
signal on list
.
Signals
Peas.ExtensionSet::extension-added
Emitted when a new extension has been added to the PeasExtensionSet
.
Peas.ExtensionSet::extension-removed
Emitted when a new extension is about to be removed from the
PeasExtensionSet
.
Signals inherited from GObject (1)
GObject::notify
The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.
Signals inherited from GListModel (1)
GListModel::items-changed
This signal is emitted whenever items were added to or removed
from list
. At position
, removed
items were removed and added
items were added in their place.