State Storage

digraph inheritance { rankdir=LR; GObject -> WpState; }
struct WpState

The WpState class saves and loads properties from a file

GObject Properties

name

The file name where the state will be stored.

WpState *wp_state_new(const gchar *name)

Constructs a new state object.

Return

(transfer full): the new WpState

Parameters
  • name: the state name

const gchar *wp_state_get_name(WpState *self)

Gets the name of a state object.

Return

the name of this state

Parameters
  • self: the state

const gchar *wp_state_get_location(WpState *self)

Gets the location of a state object.

Return

the location of this state

Parameters
  • self: the state

void wp_state_clear(WpState *self)

Clears the state removing its file.

Parameters
  • self: the state

gboolean wp_state_save(WpState *self, WpProperties *props, GError **error)

Saves new properties in the state, overwriting all previous data.

Return

TRUE if the properties could be saved, FALSE otherwise

Parameters
  • self: the state

  • props: (transfer none): the properties to save

  • error: (out)(optional): return location for a GError, or NULL

WpProperties *wp_state_load(WpState *self)

Loads the state data from the file system.

This function will never fail. If it cannot load the state, for any reason, it will simply return an empty WpProperties, behaving as if there was no previous state stored.

Return

(transfer full): a new WpProperties containing the state data

Parameters
  • self: the state

WP_TYPE_STATE (wp_state_get_type ())

The WpState GType.