Events

digraph inheritance { rankdir=LR; GBoxed -> WpEvent; }

struct WpEvent

WpEvent describes an event, an event is an entity which can be pushed on to event stack and the event dispatcher is going to pick and dispatch it.

WpEvent *wp_event_new(const gchar *type, gint priority, WpProperties *properties, GObject *source, GObject *subject)

Creates a new event.

Parameters:
  • type -- the type of the event

  • priority -- the priority of the event

  • properties -- (transfer full)(nullable): properties of the event

  • source -- (transfer none): the source of the event

  • subject -- (transfer none)(nullable): the object that the event is about

Returns:

(transfer full): the newly constructed event

const gchar *wp_event_get_name(WpEvent *self)

Gets the name of the event.

Parameters:
  • self -- the event

Returns:

the event name

WpEvent *wp_event_ref(WpEvent *self)

Increases the reference count of an event.

Parameters:
  • self -- the event

Returns:

(transfer full): self with an additional reference count on it

void wp_event_unref(WpEvent *self)

Decreases the reference count of an event, destroying it when the reference count reaches zero.

Parameters:
  • self -- (transfer full): the event

gint wp_event_get_priority(WpEvent *self)

Gets the priority of the event.

Parameters:
  • self -- the event

Returns:

the event priority

WpProperties *wp_event_get_properties(WpEvent *self)

Gets the properties of the Event.

Parameters:
  • self -- the handle

Returns:

(transfer full): the properties of the event

GObject *wp_event_get_source(WpEvent *self)

Gets the Source Object of the Event.

Parameters:
  • self -- the handle

Returns:

(transfer full): the source of the event

GObject *wp_event_get_subject(WpEvent *self)

Gets the Subject Object of the Event.

Parameters:
  • self -- the handle

Returns:

(transfer full): the subject of the event

GCancellable *wp_event_get_cancellable(WpEvent *self)

Returns the internal GCancellable that is used to track whether this event has been stopped by wp_event_stop_processing()

Parameters:
  • self -- the event

Returns:

(transfer none): the cancellable

void wp_event_stop_processing(WpEvent *self)

Stops processing of this event; any further hooks will not be executed from this moment onwards and the event will be discarded from the stack.

Parameters:
  • self -- the event

void wp_event_set_data(WpEvent *self, const gchar *key, const GValue *data)

Stores data on the event, associated with the specified key.

This can be used to exchange arbitrary data between hooks that run for this event.

Parameters:
  • self -- the event

  • key -- the key to associate data with

  • data -- (transfer none)(nullable): the data element, or NULL to remove any previous data associated with this key

const GValue *wp_event_get_data(WpEvent *self, const gchar *key)

Gets the data that was previously associated with key by wp_event_set_data()

Parameters:
  • self -- the event

  • key -- the key

Returns:

(transfer none)(nullable): the data associated with key or NULL

gboolean wp_event_collect_hooks(WpEvent *event, WpEventDispatcher *dispatcher)

Collects all the hooks registered in the dispatcher that run for this event.

Parameters:
  • event -- the event

  • dispatcher -- the event dispatcher

Returns:

TRUE if at least one hook has been collected, FALSE if no hooks run for this event or an error occurred

WpIterator *wp_event_new_hooks_iterator(WpEvent *event)

Returns an iterator that iterates over all the hooks that were collected by wp_event_collect_hooks()

Parameters:
  • event -- the event

Returns:

(transfer full): the new iterator