Class

PeasExtensionSet

Description [src]

final class Peas.ExtensionSet : GObject.Object {
  /* 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;
}

Ancestors

  • GObject

Implements

  • GListModel

Constructors

peas_extension_set_new

Create a new PeasExtensionSet for the exten_type extension type.

peas_extension_set_new_valist

Create a new PeasExtensionSet for the exten_type extension type.

peas_extension_set_new_with_properties

Create a new PeasExtensionSet for the exten_type extension type.

Instance methods

peas_extension_set_foreach

Calls func for each GObject.

peas_extension_set_get_extension

Returns the GObject object corresponding to info.

Properties

Peas.ExtensionSet:construct-properties
No description available.
Peas.ExtensionSet:engine
No description available.
Peas.ExtensionSet:extension-type
No description available.

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.

Class structure

struct PeasExtensionSetClass {
  GObjectClass parent_class;
  
}
Class members
parent_class
GObjectClass
  No description available.