Wp.Settings

g GObject.Object GObject.Object Wp.Object Wp.Object GObject.Object->Wp.Object Wp.Settings Wp.Settings Wp.Object->Wp.Settings

Subclasses:

None

Methods

Inherited:

Wp.Object (12), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

find (core, metadata_name)

class

new (core, metadata_name)

delete (name)

delete_all ()

get (name)

get_saved (name)

get_spec (name)

new_iterator ()

reset (name)

reset_all ()

save (name)

save_all ()

set (name, value)

subscribe (pattern, callback, *user_data)

subscribe_closure (pattern, closure)

unsubscribe (subscription_id)

Virtual Methods

Inherited:

Wp.Object (4), GObject.Object (7)

Properties

Inherited:

Wp.Object (4)

Name

Type

Flags

Short Description

metadata-name

str

r/w/co

The metadata object to look after

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Wp.Settings(**kwargs)
Bases:

Wp.Object

Abstract:

No

Structure:

Wp.SettingsClass

Wp.Settings loads and parses the “sm-settings” (default value) metadata, which contains wireplumber settings, and provides APIs to its clients (modules, lua scripts etc) to access them. Being a Wp.Object subclass, the settings inherits Wp.Object's activation system.

classmethod find(core, metadata_name)
Parameters:
  • core (Wp.Core) – the Wp.Core

  • metadata_name (str or None) – the name of the metadata object that the settings object is associated with; None means the default “sm-settings”

Returns:

the Wp.Settings object, or None if not found

Return type:

Wp.Settings or None

Finds a registered Wp.Settings object by its metadata name.

classmethod new(core, metadata_name)
Parameters:
  • core (Wp.Core) – the Wp.Core

  • metadata_name (str or None) – the name of the metadata object to associate with the settings object; None means the default “sm-settings”

Returns:

a new Wp.Settings object

Return type:

Wp.Settings

Creates a new Wp.Settings object.

delete(name)
Parameters:

name (str) – the name of the saved setting to be deleted

Returns:

True if the setting could be deleted, False otherwise

Return type:

bool

Deletes a saved setting to not make it persistent after reboot.

delete_all()

Deletes all saved setting to not make them persistent after reboot.

get(name)
Parameters:

name (str) – the name of the setting

Returns:

The Wp.SpaJson value of the setting, or None if the setting does not exist

Return type:

Wp.SpaJson or None

Gets the Wp.SpaJson value of a setting.

get_saved(name)
Parameters:

name (str) – the name of the setting

Returns:

The Wp.SpaJson saved value of the setting, or None if the setting does not exist

Return type:

Wp.SpaJson or None

Gets the Wp.SpaJson saved value of a setting.

get_spec(name)
Parameters:

name (str) – the name of the setting

Returns:

the specification of the setting

Return type:

Wp.SettingsSpec or None

Gets the specification of a setting.

new_iterator()
Returns:

an iterator that iterates over the settings.

Return type:

Wp.Iterator

Iterates over settings.

reset(name)
Parameters:

name (str) – the name of the setting to reset

Returns:

True if the setting could be reset, False otherwise

Return type:

bool

Resets the setting to its default value.

reset_all()

Resets all the settings to their default value.

save(name)
Parameters:

name (str) – the name of the setting to be saved

Returns:

True if the setting could be saved, False otherwise

Return type:

bool

Saves a setting to make it persistent after reboot.

save_all()

Saves all the settings to make them persistent after reboot.

set(name, value)
Parameters:
  • name (str) – the name of the setting

  • value (Wp.SpaJson) – the JSON value of the setting

Returns:

True if the setting could be set, False otherwise

Return type:

bool

Sets a new setting value.

subscribe(pattern, callback, *user_data)
Parameters:
  • pattern (str) – name of the pattern to match the settings with

  • callback (Wp.SettingsChangedCallback) – the callback triggered when the settings change.

  • user_data (object or None) – data to pass to callback

Returns:

the subscription ID (always greater than 0 for successful subscriptions)

Return type:

int

Subscribes callback for a given setting pattern(a glob-style pattern matched using GLib.pattern_match_simple), this allows clients to look for any changes made in settings through metadata.

subscribe_closure(pattern, closure)
Parameters:
Returns:

the subscription ID (always greater than 0 for success)

Return type:

int

Subscribes callback for a given setting pattern(a glob-style pattern matched using GLib.pattern_match_simple), this allows clients to look for any changes made in settings through metadata.

unsubscribe(subscription_id)
Parameters:

subscription_id (int) – identifies the callback

Returns:

True if success, False otherwise

Return type:

bool

Unsubscribes callback for a given subscription_id.

Property Details

Wp.Settings.props.metadata_name
Name:

metadata-name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The metadata object to look after