ExtensionSet
Object Hierarchy:
Description:
public sealed class ExtensionSet : Object, ListModel
Proxy for a set of extensions of the same type.
A 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.
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 ExtensionSet with ExampleActivatable as the watched extension point, and GtkWindow instances as the target objects:
```c 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; } ```