PeasActivatable

PeasActivatable — Interface for activatable plugins.

Properties

GObject * object Read / Write / Construct Only

Types and Values

Object Hierarchy

    GInterface
    ╰── PeasActivatable

Prerequisites

PeasActivatable requires GObject.

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.

Functions

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.

Parameters

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.

Parameters

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.

Parameters

activatable

A PeasActivatable.

 

Types and Values

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.

Members

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.

 

Property Details

The “object” property

  “object”                   GObject *

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.

Flags: Read / Write / Construct Only

See Also

PeasExtensionSet