summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2012-07-02 00:49:46 -0400
committerRyan Lortie <desrt@desrt.ca>2012-07-02 00:49:46 -0400
commit4eea8cb823c5a113d8209b04102f17f08df853d6 (patch)
tree5a8bb7d0c220e00981c0f0ba6e834ac8e1f6e584 /client
parent6a675a5bdef5949e2397b0d5ca9d0c8a36ccedfd (diff)
downloaddconf-4eea8cb823c5a113d8209b04102f17f08df853d6.tar.gz
Massively reorganise the client-side
This commit represents a rather complete rethinking of DConfEngine. - the different kinds of sources are now properly abstracted. This will make landing NFS support substantially easier. - there is now substantially more internal documentation - DConfEngineMessage is gone and replaced with ordinary function calls to be implemented by the D-Bus glue code - the GDBus glue has been factored out and is now shared between the client library and GSettings - the "outstanding" queue logic from the GSettings backend is now in the engine - all changes now go through a single API that accepts a (new) DConfChangeset object. Currently this only supports the current operations (ie: setting and resetting). In the future this object will also support the directory operations required by GSettingsList and will be the basis for the new approach to implementing the 'delayed' GSettingsBackend (which will be the method by which those two concepts can co-exist). The (internal) API of the engine changed substantially. This caused the following: - the libdconf client library has been rewritten in C. Most of the complicated aspects of it (that made it more convenience to use Vala) are now gone. - during the rewrite of libdconf, the DConfClient API changed a bit to look more like a proper GObject. It now makes GIO-style use of thread-default main contexts and uses GObject signals for notifications (instead of hand-rolled callbacks). - the GSettings backend has been substantially simplified (the "outstanding" logic is gone). No externally-visible changes. - the dbus-1 backend has taken a copy of the old engine code for now until it can be ported to the new engine and sufficiently tested. No externally-visible changes. - the dconf commandline tool and dconf-editor required minor changes to adjust to the DConfClient API changes There is a substantial amount of cleaning up and finishing of work to be done. There are many stubs remaining. There are likely still a large number of bugs.
Diffstat (limited to 'client')
-rw-r--r--client/Makefile.am17
-rw-r--r--client/dconf-client.c82
-rw-r--r--client/dconf-client.h85
-rw-r--r--client/dconf-client.vala380
-rw-r--r--client/dconf.deps1
-rw-r--r--client/dconf.vapi60
-rw-r--r--client/engine.vapi35
7 files changed, 121 insertions, 539 deletions
diff --git a/client/Makefile.am b/client/Makefile.am
index daebad3..119bf92 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -1,4 +1,4 @@
-AM_CFLAGS = -std=c89 -Wall -Wmissing-prototypes -Wwrite-strings -D__dconf_h__ -fPIC -DPIC
+AM_CFLAGS = -std=c89 -Wall -Wmissing-prototypes -Wwrite-strings -fPIC -DPIC
CFLAGS += -Wno-error -Wno-unused-but-set-variable -Wno-unused-variable
INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/gvdb -I$(top_srcdir)/engine $(gio_CFLAGS)
@@ -21,19 +21,12 @@ dconfinclude_HEADERS = \
dconf-client.h \
dconf.h
-libdconf_so_0_0_0_LDADD = $(gio_LIBS) ../common/libdconf-common-shared.a
+libdconf_so_0_0_0_LDADD = $(gio_LIBS) ../common/libdconf-common-shared.a ../engine/libdconf-engine.a ../gdbus/libdconf-gdbus.a
libdconf_so_0_0_0_LDFLAGS = -shared -Wl,-soname=libdconf.so.0
libdconf_so_0_0_0_SOURCES = \
- ../engine/dconf-engine.c \
- ../gvdb/gvdb-reader.c \
- dconf-client.vala engine.vapi
-libdconf_so_0_0_0_VALAFLAGS = --library dconf --pkg=gio-2.0
+ dconf-client.c
-EXTRA_DIST = dconf.vapi extra-docs.c
-dconf.vapi: libdconf.so.0
-
-dconf.deps:
- $(AM_V_GEN) echo gio-2.0 > dconf.deps
+EXTRA_DIST = dconf.vapi
vapi_DATA = dconf.vapi dconf.deps
vapidir = $(datadir)/vala/vapi
@@ -41,4 +34,4 @@ vapidir = $(datadir)/vala/vapi
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = dconf.pc
-CLEANFILES = dconf.deps libdconf.so.0 libdconf.so
+CLEANFILES = libdconf.so.0 libdconf.so
diff --git a/client/dconf-client.c b/client/dconf-client.c
index 1300269..ffc179e 100644
--- a/client/dconf-client.c
+++ b/client/dconf-client.c
@@ -23,10 +23,11 @@
#include "dconf-client.h"
#include "dconf-engine.h"
+#include <glib-object.h>
struct _DConfClient
{
- GObject parent_class;
+ GObject parent_instance;
DConfEngine *engine;
GMainContext *context;
@@ -39,7 +40,6 @@ enum
SIGNAL_CHANGED,
N_SIGNALS
};
-
static guint dconf_client_signals[N_SIGNALS];
static void
@@ -64,11 +64,11 @@ dconf_client_class_init (DConfClientClass *class)
{
class->finalize = dconf_client_finalize;
- dconf_client_signals[SIGNAL_CHANGED] =
- g_signal_new ("changed", DCONF_TYPE_CLIENT, G_SIGNAL_RUN_FIRST,
- 0, NULL, NULL, NULL, G_TYPE_NONE, 2,
- G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE,
- G_TYPE_STRV | G_SIGNAL_TYPE_STATIC_SCOPE);
+ dconf_client_signals[SIGNAL_CHANGED] = g_signal_new ("changed", DCONF_TYPE_CLIENT, G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, NULL, G_TYPE_NONE, 3,
+ G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE,
+ G_TYPE_STRV | G_SIGNAL_TYPE_STATIC_SCOPE,
+ G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE);
}
typedef struct
@@ -76,18 +76,21 @@ typedef struct
DConfClient *client;
gchar *prefix;
gchar **changes;
+ gchar *tag;
} DConfClientChange;
static gboolean
-dconf_engine_emit_changed (gpointer user_data)
+dconf_client_dispatch_change_signal (gpointer user_data)
{
DConfClientChange *change = user_data;
- g_signal_emit (change->client, dconf_client_signals[SIGNAL_CHANGED], 0, change->prefix, change->changes);
+ g_signal_emit (change->client, dconf_client_signals[SIGNAL_CHANGED], 0,
+ change->prefix, change->changes, change->tag);
+ g_object_unref (change->client);
g_free (change->prefix);
g_strfreev (change->changes);
- g_object_unref (change->client);
+ g_free (change->tag);
g_slice_free (DConfClientChange, change);
return G_SOURCE_REMOVE;
@@ -97,6 +100,7 @@ void
dconf_engine_change_notify (DConfEngine *engine,
const gchar *prefix,
const gchar * const *changes,
+ const gchar * tag,
gpointer user_data)
{
DConfClient *client = user_data;
@@ -105,13 +109,24 @@ dconf_engine_change_notify (DConfEngine *engine,
g_return_if_fail (DCONF_IS_CLIENT (client));
change = g_slice_new (DConfClientChange);
+ change->client = g_object_ref (client);
change->prefix = g_strdup (prefix);
change->changes = g_strdupv ((gchar **) changes);
- change->client = g_object_ref (client);
+ change->tag = g_strdup (tag);
- g_main_context_invoke (client->context,
- dconf_engine_emit_changed,
- change);
+ g_main_context_invoke (client->context, dconf_client_dispatch_change_signal, change);
+}
+
+DConfClient *
+dconf_client_new (void)
+{
+ DConfClient *client;
+
+ client = g_object_new (DCONF_TYPE_CLIENT, NULL);
+ client->engine = dconf_engine_new (client);
+ client->context = g_main_context_ref_thread_default ();
+
+ return client;
}
GVariant *
@@ -125,13 +140,12 @@ dconf_client_read (DConfClient *client,
gchar **
dconf_client_list (DConfClient *client,
- const gchar *dir)
+ const gchar *dir,
+ gint *length)
{
g_return_val_if_fail (DCONF_IS_CLIENT (client), NULL);
- return NULL;
-
- /*: return dconf_engine_list (client->engine, NULL, dir); */
+ return dconf_engine_list (client->engine, dir, length);
}
gboolean
@@ -143,18 +157,6 @@ dconf_client_is_writable (DConfClient *client,
return dconf_engine_is_writable (client->engine, key);
}
-static DConfChangeset *
-dconf_client_make_simple_change (const gchar *key,
- GVariant *value)
-{
- DConfChangeset *changeset;
-
- changeset = dconf_changeset_new ();
- dconf_changeset_set (changeset, key, value);
-
- return changeset;
-}
-
gboolean
dconf_client_write_fast (DConfClient *client,
const gchar *key,
@@ -166,7 +168,7 @@ dconf_client_write_fast (DConfClient *client,
g_return_val_if_fail (DCONF_IS_CLIENT (client), FALSE);
- changeset = dconf_client_make_simple_change (key, value);
+ changeset = dconf_changeset_new_write (key, value);
success = dconf_engine_change_fast (client->engine, changeset, error);
dconf_changeset_unref (changeset);
@@ -186,7 +188,7 @@ dconf_client_write_sync (DConfClient *client,
g_return_val_if_fail (DCONF_IS_CLIENT (client), FALSE);
- changeset = dconf_client_make_simple_change (key, value);
+ changeset = dconf_changeset_new_write (key, value);
success = dconf_engine_change_sync (client->engine, changeset, tag, error);
dconf_changeset_unref (changeset);
@@ -225,8 +227,8 @@ dconf_client_watch_fast (DConfClient *client,
}
void
-dconf_client_watch_sync (DConfClient *client,
- const gchar *path)
+dconf_client_watch_sync (DConfClient *client,
+ const gchar *path)
{
g_return_if_fail (DCONF_IS_CLIENT (client));
@@ -250,15 +252,3 @@ dconf_client_unwatch_sync (DConfClient *client,
dconf_engine_unwatch_sync (client->engine, path);
}
-
-DConfClient *
-dconf_client_new (void)
-{
- DConfClient *client;
-
- client = g_object_new (DCONF_TYPE_CLIENT, NULL);
- client->engine = dconf_engine_new (client);
- client->context = g_main_context_ref_thread_default ();
-
- return client;
-}
diff --git a/client/dconf-client.h b/client/dconf-client.h
index 802dce8..969e2ff 100644
--- a/client/dconf-client.h
+++ b/client/dconf-client.h
@@ -23,6 +23,7 @@
#define __dconf_client_h__
#include <gio/gio.h>
+#include "dconf-changeset.h"
G_BEGIN_DECLS
@@ -33,26 +34,12 @@ G_BEGIN_DECLS
typedef GObjectClass DConfClientClass;
typedef struct _DConfClient DConfClient;
-typedef void (*DConfWatchFunc) (DConfClient *client,
- const gchar *path,
- const gchar * const *items,
- gint n_items,
- const gchar *tag,
- gpointer user_data);
-
GType dconf_client_get_type (void);
-DConfClient * dconf_client_new (const gchar *profile,
- DConfWatchFunc watch_func,
- gpointer user_data,
- GDestroyNotify notify);
+DConfClient * dconf_client_new (void);
GVariant * dconf_client_read (DConfClient *client,
const gchar *key);
-GVariant * dconf_client_read_default (DConfClient *client,
- const gchar *key);
-GVariant * dconf_client_read_no_default (DConfClient *client,
- const gchar *key);
gchar ** dconf_client_list (DConfClient *client,
const gchar *dir,
@@ -61,70 +48,36 @@ gchar ** dconf_client_list (DConfCl
gboolean dconf_client_is_writable (DConfClient *client,
const gchar *key);
-gboolean dconf_client_write (DConfClient *client,
+gboolean dconf_client_write_fast (DConfClient *client,
const gchar *key,
GVariant *value,
- gchar **tag,
- GCancellable *cancellable,
GError **error);
-void dconf_client_write_async (DConfClient *client,
+gboolean dconf_client_write_sync (DConfClient *client,
const gchar *key,
GVariant *value,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-gboolean dconf_client_write_finish (DConfClient *client,
- GAsyncResult *result,
gchar **tag,
+ GCancellable *cancellable,
GError **error);
-gboolean dconf_client_write_many (DConfClient *client,
- const gchar *dir,
- const gchar * const *rels,
- GVariant **values,
- gint n_values,
+gboolean dconf_client_change_fast (DConfClient *client,
+ DConfChangeset *changeset,
+ GError **error);
+gboolean dconf_client_change_sync (DConfClient *client,
+ DConfChangeset *changeset,
gchar **tag,
GCancellable *cancellable,
GError **error);
-/* write_many_async currently disabled due to missing Vala functionality
-void dconf_client_write_many_async (DConfClient *client,
- const gchar *dir,
- const gchar * const *rels,
- GVariant **values,
- gint n_values,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-gboolean dconf_client_write_many_finish (DConfClient *client,
- GAsyncResult *result,
- gchar **tag,
- GError **error);*/
+void dconf_client_watch_fast (DConfClient *client,
+ const gchar *path);
+void dconf_client_watch_sync (DConfClient *client,
+ const gchar *path);
+
+void dconf_client_unwatch_fast (DConfClient *client,
+ const gchar *path);
+void dconf_client_unwatch_sync (DConfClient *client,
+ const gchar *path);
-gboolean dconf_client_watch (DConfClient *client,
- const gchar *path,
- GCancellable *cancellable,
- GError **error);
-void dconf_client_watch_async (DConfClient *client,
- const gchar *path,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-gboolean dconf_client_watch_finish (DConfClient *client,
- GAsyncResult *result,
- GError **error);
-gboolean dconf_client_unwatch (DConfClient *client,
- const gchar *path,
- GCancellable *cancellable,
- GError **error);
-void dconf_client_unwatch_async (DConfClient *client,
- const gchar *path,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-gboolean dconf_client_unwatch_finish (DConfClient *client,
- GAsyncResult *result,
- GError **error);
G_END_DECLS
#endif /* __dconf_client_h__ */
diff --git a/client/dconf-client.vala b/client/dconf-client.vala
deleted file mode 100644
index fea10d7..0000000
--- a/client/dconf-client.vala
+++ /dev/null
@@ -1,380 +0,0 @@
-[CCode (cheader_filename = "dconf.h")]
-namespace DConf {
- public delegate void WatchFunc (DConf.Client client, string path, string[] items, string tag);
-
- public class Client : Object {
- DBusConnection? session;
- DBusConnection? system;
- WatchFunc watch_func;
- Engine engine;
-
- void got_signal (DBusConnection connection, string sender_name, string object_path, string interface_name, string signal_name, Variant parameters) {
- unowned string path;
- unowned string tag;
- string[] items;
-
- if (signal_name == "Notify" && parameters.is_of_type ((VariantType) "(sass)")) {
- VariantIter iter;
-
- parameters.get ("(&sas&s)", out path, out iter, out tag);
- items = new string[iter.n_children ()];
- for (var i = 0; i < items.length; i++) {
- iter.next ("s", out items[i]);
- }
- } else if (signal_name == "WritabilityNotify" && parameters.is_of_type ((VariantType) "(s)")) {
- parameters.get ("(&s)", out path);
- items = new string[0];
- tag = "";
- } else {
- assert_not_reached ();
- }
-
- watch_func (this, path, items, tag);
- }
-
- void call_sync (EngineMessage dcem, out string tag, Cancellable? cancellable) throws Error {
- DBusConnection connection;
-
- tag = null;
-
- if (dcem.bus_types[0] == 'e') {
- if (session == null) {
- session = Bus.get_sync (BusType.SESSION, cancellable);
- if (watch_func != null) {
- session.signal_subscribe (null, "ca.desrt.dconf.Writer", null, null, null, DBusSignalFlags.NO_MATCH_RULE, got_signal);
- }
- }
- connection = session;
- } else {
- assert (dcem.bus_types[0] == 'y');
- if (system == null) {
- system = Bus.get_sync (BusType.SYSTEM, cancellable);
- if (watch_func != null) {
- system.signal_subscribe (null, "ca.desrt.dconf.Writer", null, null, null, DBusSignalFlags.NO_MATCH_RULE, got_signal);
- }
- }
- connection = system;
- }
-
- foreach (var message in dcem.parameters) {
- var reply = connection.call_sync (dcem.bus_name, dcem.object_path, dcem.interface_name, dcem.method_name,
- message, dcem.reply_type, DBusCallFlags.NONE, -1, cancellable);
- if (!dcem.reply_type.equal (VariantType.UNIT)) {
- reply.get ("(s)", out tag);
- }
- }
- }
-
- async void call_async (EngineMessage dcem, out string tag, Cancellable? cancellable) throws Error {
- DBusConnection connection;
-
- tag = null;
-
- if (dcem.bus_types[0] == 'e') {
- if (session == null) {
- session = yield Bus.get (BusType.SESSION, cancellable);
- }
- connection = session;
- } else {
- assert (dcem.bus_types[0] == 'y');
- if (system == null) {
- system = yield Bus.get (BusType.SYSTEM, cancellable);
- }
- connection = system;
- }
-
- foreach (var message in dcem.parameters) {
- var reply = yield connection.call (dcem.bus_name, dcem.object_path, dcem.interface_name, dcem.method_name,
- message, dcem.reply_type, DBusCallFlags.NONE, -1, cancellable);
- if (dcem.reply_type != VariantType.UNIT) {
- reply.get ("(s)", out tag);
- }
- }
- }
-
- /**
- * dconf_client_is_writable:
- * @client: a #DConfClient
- * @key: a dconf key
- * Returns: %TRUE is @key is writable
- *
- * Checks if @key is writable (ie: the key has no mandatory setting).
- *
- * This call does not verify that writing to the key will actually be successful. It only checks for
- * the existence of mandatory keys/locks that might affect writing to @key. Other issues (such as a
- * full disk or an inability to connect to the bus and start the service) may cause the write to fail.
- **/
- public bool is_writable (string key) {
- return engine.is_writable (key);
- }
-
- /**
- * dconf_client_write:
- * @client: a #DConfClient
- * @key: a dconf key
- * @value: (allow-none): a #GVariant, or %NULL
- * @tag: (out) (allow-none): the tag from this write
- * @cancellable: a #GCancellable, or %NULL
- * @error: a pointer to a #GError, or %NULL
- * Returns: %TRUE if the write is successful
- *
- * Write a value to the given @key, or reset @key to its default value.
- *
- * If @value is %NULL then @key is reset to its default value (which may
- * be completely unset), otherwise @value becomes the new value.
- *
- * If @tag is non-%NULL then it is set to the unique tag associated with this write. This is the same
- * tag that appears in change notifications.
- **/
- public bool write (string key, Variant? value, out string tag = null, Cancellable? cancellable = null) throws Error {
- call_sync (engine.write (key, value), out tag, cancellable);
- return true;
- }
-
- /**
- * dconf_client_write_async:
- * @client: a #DConfClient
- * @key: a dconf key
- * @value: (allow-none): a #GVariant, or %NULL
- * @cancellable: a #GCancellable, or %NULL
- * @callback: the function to call when complete
- * @user_data: the user data for @callback
- *
- * Write a value to the given @key, or reset @key to its default value.
- *
- * This is the asynchronous version of dconf_client_write(). You should call
- * dconf_client_write_finish() from @callback to collect the result.
- **/
- public async bool write_async (string key, Variant? value, out string tag = null, Cancellable? cancellable = null) throws Error {
- yield call_async (engine.write (key, value), out tag, cancellable);
- return true;
- }
-
- /**
- * dconf_client_write_many:
- * @client: a #DConfClient
- * @dir: the dconf directory under which to make the writes
- * @rels: a %NULL-terminated array of relative keys
- * @values: an array of possibly-%NULL #GVariant pointers
- * @n_values: the length of @values, which must be equal to the length of @rels
- * @tag: (out) (allow-none): the tag from this write
- * @cancellable: a #GCancellable, or %NULL
- * @error: a pointer to a #GError, or %NULL
- * Returns: %TRUE if the write is successful
- *
- * Write multiple values at once.
- *
- * For each pair of items from @rels and @values, the value is written to the result of concatenating
- * @dir with the relative path. As with dconf_client_write(), if a given value is %NULL then the effect
- * is that the specified key is reset.
- *
- * If @tag is non-%NULL then it is set to the unique tag associated with this write. This is the same
- * tag that appears in change notifications.
- **/
- public bool write_many (string dir, [CCode (array_length = false, array_null_terminated = true)] string[] rels, Variant?[] values, out string? tag = null, Cancellable? cancellable = null) throws Error {
- call_sync (engine.write_many (dir, rels, values), out tag, cancellable);
- return true;
- }
-
- /*< disabled due to Vala compiler bugs >
- * dconf_client_write_many_async:
- * @client: a #DConfClient
- * @dir: the dconf directory under which to make the writes
- * @rels: a %NULL-terminated array of relative keys
- * @values: an array of possibly-%NULL #GVariant pointers
- * @n_values: the length of @values, which must be equal to the length of @rels
- * @cancellable: a #GCancellable, or %NULL
- * @callback: a #GAsyncReadyCallback to call when finished
- * @user_data: a pointer to pass as the last argument to @callback
- *
- * Write multiple values at once.
- *
- * This is the asynchronous version of dconf_client_write_many(). You should call
- * dconf_client_write_many_finish() from @callback to collect the result.
- *
- public async bool write_many_async (string dir, [CCode (array_length = false, array_null_terminated = true)] string[] rels, Variant?[] values, out string? tag = null, Cancellable? cancellable = null) throws Error {
- yield call_async (engine.write_many (dir, rels, values), out tag, cancellable);
- return true;
- }*/
-
- /**
- * dconf_client_read:
- * @client: a #DConfClient
- * @key: a valid dconf key
- * Returns: the value corresponding to @key, or %NULL if there is none
- *
- * Reads the value named by @key from dconf. If no such value exists, %NULL is returned.
- **/
- public Variant? read (string key) {
- return engine.read (key);
- }
-
- /**
- * dconf_client_read_default:
- * @client: a #DConfClient
- * @key: a valid dconf key
- * Returns: the default value corresponding to @key, or %NULL if there is none
- *
- * Reads the value named by @key from any existing default/mandatory databases but ignoring any value
- * set by the user. The result is as if the named key had just been reset.
- **/
- public Variant? read_default (string key) {
- return engine.read_default (key);
- }
-
- /**
- * dconf_client_read_no_default:
- * @client: a #DConfClient
- * @key: a valid dconf key
- * Returns: the user value corresponding to @key, or %NULL if there is none
- *
- * Reads the value named by @key as set by the user, ignoring any default/mandatory databases. Normal
- * applications will never want to do this, but it may be useful for administrative or configuration
- * tweaking utilities to have access to this information.
- *
- * Note that in the case of mandatory keys, the result of dconf_client_read_no_default() with a fallback
- * to dconf_client_read_default() is not necessarily the same as the result of a dconf_client_read().
- * This is because the user may have set a value before the key became marked as mandatory, in which
- * case this call will see the user's (otherwise inaccessible) key.
- **/
- public Variant? read_no_default (string key) {
- return engine.read_no_default (key);
- }
-
- /**
- * dconf_client_list:
- * @client: a #DConfClient
- * @dir: a dconf dir
- * @length: the number of items that were returned
- * Returns: (array length=length): the paths located directly below @dir
- *
- * Lists the keys and dirs located directly below @dir.
- *
- * You should free the return result with g_strfreev() when it is no longer needed.
- **/
- public string[] list (string dir) {
- return engine.list (dir);
- }
-
- /**
- * dconf_client_watch:
- * @client: a #DConfClient
- * @path: a dconf path
- * @cancellable: a #GCancellable, or %NULL
- * @error: a pointer to a %NULL #GError, or %NULL
- * Returns: %TRUE on success, else %FALSE with @error set
- *
- * Requests monitoring of a portion of the dconf database.
- *
- * If @path is a key (ie: doesn't end with a slash) then a single key is monitored for changes. If
- * @path is a dir (ie: sending with a slash) then all keys that have @path as a prefix are monitored.
- *
- * This function blocks until the watch has definitely been established with the bus daemon. If you
- * would like a non-blocking version of this call, see dconf_client_watch_async().
- **/
- public bool watch (string path, Cancellable? cancellable = null) throws GLib.Error {
- call_sync (engine.watch (path), null, cancellable);
- return true;
- }
-
- /**
- * dconf_client_watch_async:
- * @client: a #DConfClient
- * @path: a dconf path
- * @cancellable: a #GCancellable, or %NULL
- * @callback: a #GAsyncReadyCallback to call when finished
- * @user_data: a pointer to pass as the last argument to @callback
- *
- * Requests monitoring of a portion of the dconf database.
- *
- * This is the asynchronous version of dconf_client_watch(). You should call
- * dconf_client_watch_finish() from @callback to collect the result.
- **/
- public async bool watch_async (string name, Cancellable? cancellable = null) throws GLib.Error {
- yield call_async (engine.watch (name), null, cancellable);
- return true;
- }
-
- /**
- * dconf_client_unwatch:
- * @client: a #DConfClient
- * @path: a dconf path
- * @cancellable: a #GCancellable, or %NULL
- * @error: a pointer to a %NULL #GError, or %NULL
- * Returns: %TRUE on success, else %FALSE with @error set
- *
- * Cancels the effect of a previous call to dconf_client_watch().
- *
- * If the same path has been watched multiple times then only one of the watches is cancelled and the
- * net effect is that the path is still watched.
- *
- * This function blocks until the watch has definitely been removed from the bus daemon. It is possible
- * that notifications in transit will arrive after this call returns. For an asynchronous version of
- * this call, see dconf_client_unwatch_async().
- **/
- public bool unwatch (string name, Cancellable? cancellable = null) throws GLib.Error {
- call_sync (engine.unwatch (name), null, cancellable);
- return true;
- }
-
- /**
- * dconf_client_unwatch_async:
- * @client: a #DConfClient
- * @path: a dconf path
- * @cancellable: a #GCancellable, or %NULL
- * @callback: a #GAsyncReadyCallback to call when finished
- * @user_data: a pointer to pass as the last argument to @callback
- *
- * Cancels the effect of a previous call to dconf_client_watch().
- *
- * This is the asynchronous version of dconf_client_unwatch(). You should call
- * dconf_client_unwatch_finish() from @callback to collect the result. No additional notifications will
- * be delivered for this watch after @callback is called.
- **/
- public async bool unwatch_async (string name, Cancellable? cancellable = null) throws GLib.Error {
- yield call_async (engine.unwatch (name), null, cancellable);
- return true;
- }
-
- /**
- * dconf_client_new:
- * @profile: the dconf profile to use, or %NULL
- * @watch_func: the function to call when changes occur
- * @user_data: the user_data to pass to @watch_func
- * @notify: the function to free @user_data when no longer needed
- * Returns: a new #DConfClient
- *
- * Creates a new #DConfClient for the given context.
- *
- * If @profile is non-%NULL then it specifies the name of the profile to use. If @profile is %NULL then
- * the DCONF_PROFILE environment variable is consulted. If that is unset then the default profile of
- * "user" is used. If a profile named "user" is not installed then the dconf client is setup to access
- * ~/.config/dconf/user.
- **/
- public Client (string? profile = null, owned WatchFunc? watch_func = null) {
- engine = new Engine (profile);
- this.watch_func = (owned) watch_func;
- }
- }
-
- public extern bool is_path (string str, Error *error = null);
- public extern bool is_key (string str, Error *error = null);
- public extern bool is_dir (string str, Error *error = null);
- public extern bool is_rel_path (string str, Error *error = null);
- public extern bool is_rel_key (string str, Error *error = null);
- public extern bool is_rel_dir (string str, Error *error = null);
- [CCode (cname = "dconf_is_path")]
- public extern bool verify_path (string str) throws Error;
- [CCode (cname = "dconf_is_key")]
- public extern bool verify_key (string str) throws Error;
- [CCode (cname = "dconf_is_dir")]
- public extern bool verify_dir (string str) throws Error;
- [CCode (cname = "dconf_is_rel_path")]
- public extern bool verify_rel_path (string str) throws Error;
- [CCode (cname = "dconf_is_rel_key")]
- public extern bool verify_rel_key (string str) throws Error;
- [CCode (cname = "dconf_is_rel_dir")]
- public extern bool verify_rel_dir (string str) throws Error;
-}
-
-// vim:noet sw=4 ts=4
diff --git a/client/dconf.deps b/client/dconf.deps
new file mode 100644
index 0000000..cd10dfd
--- /dev/null
+++ b/client/dconf.deps
@@ -0,0 +1 @@
+gio-2.0
diff --git a/client/dconf.vapi b/client/dconf.vapi
new file mode 100644
index 0000000..af293aa
--- /dev/null
+++ b/client/dconf.vapi
@@ -0,0 +1,60 @@
+/* dconf.vapi generated by valac 0.17.1.35-814b, do not modify. */
+
+namespace DConf {
+ [CCode (cheader_filename = "dconf.h")]
+ public class Client : GLib.Object {
+ public signal void changed (string prefix, string[] changes, string tag);
+
+ public Client ();
+ public GLib.Variant? read (string key);
+ public string[] list (string dir);
+ public bool is_writable (string key);
+ public void write_fast (string path, GLib.Variant? value) throws GLib.Error;
+ public void write_sync (string path, GLib.Variant? value, out string tag = null, GLib.Cancellable? cancellable = null) throws GLib.Error;
+ public void change_fast (Changeset changeset) throws GLib.Error;
+ public void change_sync (Changeset changeset, out string tag = null, GLib.Cancellable? cancellable = null) throws GLib.Error;
+ public void watch_fast (string path);
+ public void unwatch_fast (string path);
+ public void watch_sync (string path);
+ public void unwatch_sync (string path);
+ }
+
+ [Compact]
+ [CCode (ref_function = "dconf_changeset_ref", unref_function = "dconf_changeset_unref")]
+ public class Changeset {
+ public delegate bool Predicate (string path, GLib.Variant? value);
+ public Changeset ();
+ public Changeset.write (string path, GLib.Variant? value);
+ public void set (string path, GLib.Variant? value);
+ public bool get (string path, out GLib.Variant? value);
+ public bool is_similar_to (Changeset other);
+ public bool all (Predicate predicate);
+ public GLib.Variant serialise ();
+ public static Changeset deserialise (GLib.Variant serialised);
+ }
+
+ [CCode (cheader_filename = "dconf.h")]
+ public static bool is_dir (string str, GLib.Error* error = null);
+ [CCode (cheader_filename = "dconf.h")]
+ public static bool is_key (string str, GLib.Error* error = null);
+ [CCode (cheader_filename = "dconf.h")]
+ public static bool is_path (string str, GLib.Error* error = null);
+ [CCode (cheader_filename = "dconf.h")]
+ public static bool is_rel_dir (string str, GLib.Error* error = null);
+ [CCode (cheader_filename = "dconf.h")]
+ public static bool is_rel_key (string str, GLib.Error* error = null);
+ [CCode (cheader_filename = "dconf.h")]
+ public static bool is_rel_path (string str, GLib.Error* error = null);
+ [CCode (cheader_filename = "dconf.h", cname = "dconf_is_dir")]
+ public static bool verify_dir (string str) throws GLib.Error;
+ [CCode (cheader_filename = "dconf.h", cname = "dconf_is_key")]
+ public static bool verify_key (string str) throws GLib.Error;
+ [CCode (cheader_filename = "dconf.h", cname = "dconf_is_path")]
+ public static bool verify_path (string str) throws GLib.Error;
+ [CCode (cheader_filename = "dconf.h", cname = "dconf_is_rel_dir")]
+ public static bool verify_rel_dir (string str) throws GLib.Error;
+ [CCode (cheader_filename = "dconf.h", cname = "dconf_is_rel_key")]
+ public static bool verify_rel_key (string str) throws GLib.Error;
+ [CCode (cheader_filename = "dconf.h", cname = "dconf_is_rel_path")]
+ public static bool verify_rel_path (string str) throws GLib.Error;
+}
diff --git a/client/engine.vapi b/client/engine.vapi
deleted file mode 100644
index 48dce55..0000000
--- a/client/engine.vapi
+++ /dev/null
@@ -1,35 +0,0 @@
-namespace DConf {
- [Compact]
- [CCode (cheader_filename = "dconf-engine.h")]
- class Engine {
- internal Engine (string? profile);
- internal bool is_writable (string key);
- internal EngineMessage write (string key, GLib.Variant? value) throws GLib.Error;
- internal EngineMessage write_many (string dir, [CCode (array_length = false, array_null_terminated = true, type = "const gchar * const *")] string[] keys, [CCode (array_length = false)] GLib.Variant?[] values) throws GLib.Error;
- internal GLib.Variant? read (string key);
- internal GLib.Variant? read_default (string key);
- internal GLib.Variant? read_no_default (string key);
- internal EngineMessage set_locked (string key, bool locked);
- internal string[] list (string dir);
- internal EngineMessage watch (string name);
- internal EngineMessage unwatch (string name);
- }
-
- struct EngineMessage {
- string bus_name;
- string object_path;
- string interface_name;
- string method_name;
- int n_messages;
- [CCode (array_length_cname = "n_messages")]
- GLib.Variant[] parameters;
- [CCode (array_length_cname = "n_messages")]
- char[] bus_types;
- GLib.VariantType reply_type;
- }
-
- [CCode (has_target = false)]
- delegate GLib.Variant? ServiceFunc (EngineMessage dcem);
-}
-
-// vim:noet sw=4 ts=4