PeasActivatable

PeasActivatable — Interface for activatable plugins.

Synopsis

                    PeasActivatable;
struct              PeasActivatableInterface;
void                peas_activatable_activate           (PeasActivatable *activatable);
void                peas_activatable_deactivate         (PeasActivatable *activatable);
void                peas_activatable_update_state       (PeasActivatable *activatable);

Object Hierarchy

  GInterface
   +----PeasActivatable

Prerequisites

PeasActivatable requires GObject.

Properties

  "object"                   GObject*              : Read / Write / Construct Only

Description

PeasActivatable is an interface which should be implemented by plugins that should be activated on an object of a certain type (depending on the application). For instance, in a typical windowed application, PeasActivatable plugin instances could be bound to individual toplevel windows.

It is typical to use PeasActivatable along with PeasExtensionSet in order to activate and deactivate extensions automatically when plugins are loaded or unloaded.

You can also use the code of this interface as a base for your own extension types, as illustrated by gedit's GeditWindowActivatable and GeditDocumentActivatable interfaces.

Details

PeasActivatable

typedef struct _PeasActivatable PeasActivatable;

Interface for activatable plugins.


struct PeasActivatableInterface

struct PeasActivatableInterface {
  GTypeInterface g_iface;

  /* Virtual public methods */
  void        (*activate)                 (PeasActivatable *activatable);
  void        (*deactivate)               (PeasActivatable *activatable);
  void        (*update_state)             (PeasActivatable *activatable);
};

Provides an interface for activatable plugins.

GTypeInterface g_iface;

The parent interface.

activate ()

Activates the plugin.

deactivate ()

Deactivates the plugin.

update_state ()

Updates the plugin's internal state to take account of a change in the target object's state.

peas_activatable_activate ()

void                peas_activatable_activate           (PeasActivatable *activatable);

Activates the extension on the targetted object.

On activation, the extension should hook itself to the object where it makes sense.

activatable :

A PeasActivatable.

peas_activatable_deactivate ()

void                peas_activatable_deactivate         (PeasActivatable *activatable);

Deactivates the extension on the targetted object.

On deactivation, an extension should remove itself from all the hooks it used and should perform any cleanup required, so it can be unreffed safely and without any more effect on the host application.

activatable :

A PeasActivatable.

peas_activatable_update_state ()

void                peas_activatable_update_state       (PeasActivatable *activatable);

Triggers an update of the extension internal state to take into account state changes in the targetted object, due to some event or user action.

activatable :

A PeasActivatable.

Property Details

The "object" property

  "object"                   GObject*              : Read / Write / Construct Only

The object property contains the targetted object for this PeasActivatable instance, for example a toplevel window in a typical windowed application. It is set at construction time and won't change.

See Also

PeasExtensionSet