Static Configuration
-
struct WpConf
WpConf allows accessing the different sections of the wireplumber configuration.
-
enum WpConfSectionMode
- Since
0.6.0 Selects which sections wp_conf_new_sections_iterator() returns.
Values:
-
enumerator WP_CONF_SECTION_MODE_ALL = 0
All original, unmerged section definitions
-
enumerator WP_CONF_SECTION_MODE_MERGED
Unique logical section names, without the "override." prefix
-
WpConf *wp_conf_new(const gchar *name, WpProperties *properties)
Creates a new WpConf object.
This does not open the files, it only creates the object. For most use cases, you should use wp_conf_new_open() instead.
- Parameters:
name -- the name of the configuration file
properties -- (transfer full) (nullable): a WpProperties with keys specifying how to load the WpConf object
- Returns:
(transfer full): a new WpConf object
-
WpConf *wp_conf_new_open(const gchar *name, WpProperties *properties, GError **error)
Creates a new WpConf object and opens the configuration file and its fragments, keeping them mapped in memory for further access.
- Parameters:
name -- the name of the configuration file
properties -- (transfer full) (nullable): a WpProperties with keys specifying how to load the WpConf object
error -- (out) (nullable): return location for a GError, or NULL
- Returns:
(transfer full) (nullable): a new WpConf object, or NULL if an error occurred
-
gboolean wp_conf_open(WpConf *self, GError **error)
Opens the configuration file and its fragments and keeps them mapped in memory for further access.
- Parameters:
self -- the configuration
error -- (out)(nullable): return location for a GError, or NULL
- Returns:
TRUE on success, FALSE on error
-
void wp_conf_close(WpConf *self)
Closes the configuration file and its fragments.
- Parameters:
self -- the configuration
-
gboolean wp_conf_is_open(WpConf *self)
Tests if the configuration files are open.
- Parameters:
self -- the configuration
- Returns:
TRUE if the configuration files are open, FALSE otherwise
-
const gchar *wp_conf_get_name(WpConf *self)
Gets the name of the configuration file.
- Parameters:
self -- the configuration
- Returns:
the name of the configuration file
-
WpIterator *wp_conf_new_sections_iterator(WpConf *self, WpConfSectionMode mode)
Creates an iterator for the loaded configuration sections.
Each iterator item is a WpSpaJson object. Depending on mode, the object contains "section.name", "section.location" and "section.value", or only a unique logical "section.name".
- Since
0.6.0
- Parameters:
self -- the configuration
mode -- the information to list
- Returns:
(transfer full): an iterator of WpSpaJson items
-
WpIterator *wp_conf_new_locations_iterator(WpConf *self)
Creates an iterator for the loaded configuration file locations.
Each iterator item is a WpSpaJson object containing "section.location".
- Since
0.6.0
- Parameters:
self -- the configuration
- Returns:
(transfer full): an iterator of WpSpaJson items
-
WpSpaJson *wp_conf_get_section(WpConf *self, const gchar *section)
This method will get the JSON value of a specific section from the configuration. If the same section is defined in multiple locations, the sections with the same name will be either merged in case of arrays and objects, or overridden in case of boolean, int, double and strings.
- Parameters:
self -- the configuration
section -- the section name
- Returns:
(transfer full) (nullable): the JSON value of the section or NULL if the section does not exist
-
gint wp_conf_section_update_props(WpConf *self, const gchar *section, WpProperties *props)
Updates the given properties with the values of a specific section from the configuration.
- Parameters:
self -- the configuration
section -- the section name
props -- the properties to update
- Returns:
the number of properties updated
-
WP_TYPE_CONF (wp_conf_get_type ())
The WpConf GType.