Top |
gboolean | (*DConfChangesetPredicate) () |
gboolean | dconf_changeset_all () |
void | dconf_changeset_change () |
guint | dconf_changeset_describe () |
DConfChangeset * | dconf_changeset_deserialise () |
DConfChangeset * | dconf_changeset_diff () |
gboolean | dconf_changeset_get () |
gboolean | dconf_changeset_is_empty () |
gboolean | dconf_changeset_is_similar_to () |
DConfChangeset * | dconf_changeset_new () |
DConfChangeset * | dconf_changeset_new_database () |
DConfChangeset * | dconf_changeset_new_write () |
DConfChangeset * | dconf_changeset_ref () |
GVariant * | dconf_changeset_serialise () |
void | dconf_changeset_set () |
void | dconf_changeset_unref () |
void | dconf_changeset_seal () |
DConfChangeset represents a set of changes that can be made to a dconf database. Currently supported operations are writing new values to keys and resetting keys and dirs.
Create the changeset with dconf_changeset_new()
and populate it with
dconf_changeset_set()
. Submit it to dconf with
dconf_client_change_fast()
or dconf_client_change_sync()
.
dconf_changeset_new_write()
is a convenience constructor for the
common case of writing or resetting a single value.
gboolean (*DConfChangesetPredicate) (const gchar *path
,GVariant *value
,gpointer user_data
);
Callback function type for predicates over items in a DConfChangeset.
Use with dconf_changeset_all()
.
path |
a path, as per |
|
value |
a GVariant, or |
[nullable] |
user_data |
user data pointer |
gboolean dconf_changeset_all (DConfChangeset *changeset
,DConfChangesetPredicate predicate
,gpointer user_data
);
Checks if all changes in the changeset satisfy predicate
.
predicate
is called on each item in the changeset, in turn, until it
returns FALSE
.
If predicate
returns FALSE
for any item, this function returns
FALSE
. If not (including the case of no items) then this function
returns TRUE
.
void dconf_changeset_change (DConfChangeset *changeset
,DConfChangeset *changes
);
Applies changes
to changeset
.
If changeset
is a normal changeset then reset requests in changes
will be allied to changeset
and then copied down into it. In this
case the two changesets are effectively being merged.
If changeset
is in database mode then the reset operations in
changes
will simply be applied to changeset
.
Since: 0.16
guint dconf_changeset_describe (DConfChangeset *changeset
,const gchar **prefix
,const gchar * const **paths
,GVariant * const **values
);
Describes changeset
.
prefix
and paths
are presented in the same way as they are for the
DConfClient::changed signal. values
is an array of the same length
as paths
. For each key described by an element in paths
, values
will contain either a GVariant (the requested new value of that key)
or NULL
(to reset a reset).
The paths
array is returned in an order such that dir will always
come before keys contained within those dirs.
If changeset
is not already sealed then this call will implicitly
seal it. See dconf_changeset_seal()
.
DConfChangeset *
dconf_changeset_deserialise (GVariant *serialised
);
Creates a DConfChangeset according to a serialised description
returned from an earlier call to dconf_changeset_serialise()
.
serialised
has no particular format -- you should only pass a value
that resulted from an earlier serialise operation.
This call never fails, even if serialised
is not in the correct
format. Improperly-formatted parts are simply ignored.
DConfChangeset * dconf_changeset_diff (DConfChangeset *from
,DConfChangeset *to
);
Compares to database-mode changesets and produces a changeset that describes their differences.
If there is no difference, NULL
is returned.
Applying the returned changeset to from
using
dconf_changeset_change()
will result in the two changesets being
equal.
Since: 0.16
gboolean dconf_changeset_get (DConfChangeset *changeset
,const gchar *key
,GVariant **value
);
Checks if a DConfChangeset has an outstanding request to change
the value of the given key
.
If the change doesn't involve key
then FALSE
is returned and the
value
is unmodified.
If the change modifies key
then value
is set either to the value
for that key, or NULL
in the case that the key is being reset by the
request.
gboolean
dconf_changeset_is_empty (DConfChangeset *changeset
);
Checks if changeset
is empty (ie: contains no changes).
gboolean dconf_changeset_is_similar_to (DConfChangeset *changeset
,DConfChangeset *other
);
Checks if changeset
is similar to other
.
Two changes are considered similar if they write to the exact same set of keys. The values written are not considered.
This check is used to prevent building up a queue of repeated writes of the same keys. This is often seen when an application writes to a key on every move of a slider or an application window.
Strictly speaking, a write resettings all of "/a/" after a write containing "/a/b" could cause the later to be removed from the queue, but this situation is difficult to detect and is expected to be extremely rare.
DConfChangeset *
dconf_changeset_new (void
);
Creates a new, empty, DConfChangeset.
DConfChangeset *
dconf_changeset_new_database (DConfChangeset *copy_of
);
Creates a new DConfChangeset in "database" mode, possibly initialising it with the values of another changeset.
In a certain sense it's possible to imagine that a DConfChangeset could express the contents of an entire dconf database -- the contents are the database are what you would have if you applied the changeset to an empty database. One thing that fails to map in this analogy are reset operations -- if we start with an empty database then reset operations are meaningless.
A "database" mode changeset is therefore a changeset which is incapable of containing reset operations.
It is not permitted to use a database-mode changeset for most
operations (such as the change
argument to dconf_changeset_change()
or the changeset
argument to DConfClient APIs).
If copy_of
is non-NULL
then its contents will be copied into the
created changeset. copy_of
must be a database-mode changeset.
Since: 0.16
DConfChangeset * dconf_changeset_new_write (const gchar *path
,GVariant *value
);
Creates a new DConfChangeset with one change. This is equivalent to
calling dconf_changeset_new()
and then dconf_changeset_set()
with
path
and value
.
DConfChangeset *
dconf_changeset_ref (DConfChangeset *changeset
);
Increases the reference count on changeset
GVariant *
dconf_changeset_serialise (DConfChangeset *changeset
);
Serialises a DConfChangeset.
The returned value has no particular format and should only be passed
to dconf_changeset_deserialise()
.
void dconf_changeset_set (DConfChangeset *changeset
,const gchar *path
,GVariant *value
);
Adds an operation to modify path
to a DConfChangeset.
path
may either be a key or a dir. If it is a key then value
may
be a GVariant, or NULL
(to set or reset the key).
If path
is a dir then this must be a reset operation: value
must be
NULL
. It is not permitted to assign a GVariant value to a dir.
void
dconf_changeset_unref (DConfChangeset *changeset
);
Releases a DConfChangeset reference.
void
dconf_changeset_seal (DConfChangeset *changeset
);
Seals changeset
.
When a DConfChangeset is first created, it is mutable and non-threadsafe. Once the changeset is populated with the required changes, it can be shared between multiple threads, but only by making it immutable by "sealing" it.
After the changeset is sealed, you cannot call dconf_changeset_set()
or any other functions that would modify it. It is safe, however, to
share it between multiple threads.
All changesets are unsealed on creation, including those that are
made by copying changesets that are sealed.
dconf_changeset_describe()
will implicitly seal a changeset.
This function is idempotent.
Since: 0.18
typedef struct _DConfChangeset DConfChangeset;
This is a reference counted opaque structure type. It is not a GObject.
Use dconf_changeset_ref()
and dconf_changeset_unref()
to manipulate
references.