
There is no real use for groups in our API. Just use the name of the file as the default group and be done with it... Storing multiple groups with this API is problematic because it forces flushing the file to disk multiple times, one for each group, and it's just more performant if we use a prefix in the keys to implement some form of logical separation. This commit also makes the GKeyFile a temporary object. As we always load the file from the file system in _load() and we always replace its contents with a new dictionary in _save(), there is no point in keeping the keyfile's internal data structures stored in memory. Save errors are now also propagated to adhere to the programming practices of GObject
47 lines
817 B
C
47 lines
817 B
C
/* WirePlumber
|
|
*
|
|
* Copyright © 2020 Collabora Ltd.
|
|
* @author Julian Bouzas <julian.bouzas@collabora.com>
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
#ifndef __WIREPLUMBER_STATE_H__
|
|
#define __WIREPLUMBER_STATE_H__
|
|
|
|
#include "properties.h"
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
/* WpState */
|
|
|
|
/*!
|
|
* \brief The WpState GType
|
|
* \ingroup wpstate
|
|
*/
|
|
#define WP_TYPE_STATE (wp_state_get_type ())
|
|
WP_API
|
|
G_DECLARE_FINAL_TYPE (WpState, wp_state, WP, STATE, GObject)
|
|
|
|
WP_API
|
|
WpState * wp_state_new (const gchar *name);
|
|
|
|
WP_API
|
|
const gchar * wp_state_get_name (WpState *self);
|
|
|
|
WP_API
|
|
const gchar * wp_state_get_location (WpState *self);
|
|
|
|
WP_API
|
|
void wp_state_clear (WpState *self);
|
|
|
|
WP_API
|
|
gboolean wp_state_save (WpState *self, WpProperties *props, GError ** error);
|
|
|
|
WP_API
|
|
WpProperties * wp_state_load (WpState *self);
|
|
|
|
G_END_DECLS
|
|
|
|
#endif
|