[dconf] set_lock -> set_locked and cleanup gtk-doc
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf] set_lock -> set_locked and cleanup gtk-doc
- Date: Wed, 4 Aug 2010 01:03:48 +0000 (UTC)
commit 9dd9bcfc132980f0056f8bfc31669029d90860d9
Author: Ryan Lortie <desrt desrt ca>
Date: Tue Aug 3 17:50:57 2010 -0400
set_lock -> set_locked and cleanup gtk-doc
Rename set_lock to set_locked again (and same SetLock -> SetLocked).
Add missing gtk-doc bits, clean up some that are no longer there.
Bump gtk-doc dependency.
bin/dconf.vala | 2 +-
client/Makefile.am | 2 +-
client/dconf-client.h | 6 +-
client/dconf-client.vala | 129 ++++++++++++++++++++++++++++++++++++++++++--
client/engine.vapi | 2 +-
common/dconf-paths.c | 6 ++
configure.ac | 2 +-
docs/Makefile.am | 3 +-
docs/dconf-sections.txt | 2 -
engine/dconf-engine.c | 10 ++--
engine/dconf-engine.h | 2 +-
service/dconf-interfaces.c | 14 +++---
service/service.c | 2 +-
13 files changed, 154 insertions(+), 28 deletions(-)
---
diff --git a/bin/dconf.vala b/bin/dconf.vala
index d052a11..c0c35bb 100644
--- a/bin/dconf.vala
+++ b/bin/dconf.vala
@@ -47,7 +47,7 @@ void do_write (DConf.Client client, string key, string val) throws Error {
void do_lock (DConf.Client client, string key, bool locked) throws Error {
DConf.verify_key (key);
- client.set_lock (key, locked);
+ client.set_locked (key, locked);
}
void do_watch (DConf.Client client, string name) throws Error {
diff --git a/client/Makefile.am b/client/Makefile.am
index 45e7e6f..9d716ce 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -46,7 +46,7 @@ EXTRA_DIST = dconf.vapi
dconf.vapi: libdconf.so.0
dconf.deps:
- echo gio-2.0 > dconf.deps
+ $(AM_V_GEN) echo gio-2.0 > dconf.deps
vapi_DATA = dconf.vapi dconf.deps
vapidir = $(datadir)/vala/vapi
diff --git a/client/dconf-client.h b/client/dconf-client.h
index 137fe18..9dca7b2 100644
--- a/client/dconf-client.h
+++ b/client/dconf-client.h
@@ -79,18 +79,18 @@ gboolean dconf_client_write_finish (DConfCl
gchar **tag,
GError **error);
-gboolean dconf_client_set_lock (DConfClient *client,
+gboolean dconf_client_set_locked (DConfClient *client,
const gchar *path,
gboolean locked,
GCancellable *cancellable,
GError **error);
-void dconf_client_set_lock_async (DConfClient *client,
+void dconf_client_set_locked_async (DConfClient *client,
const gchar *path,
gboolean locked,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
-gboolean dconf_client_set_lock_finish (DConfClient *client,
+gboolean dconf_client_set_locked_finish (DConfClient *client,
GAsyncResult *result,
GError **error);
diff --git a/client/dconf-client.vala b/client/dconf-client.vala
index 5db8767..b929241 100644
--- a/client/dconf-client.vala
+++ b/client/dconf-client.vala
@@ -58,6 +58,24 @@ namespace DConf {
}
}
+ /**
+ * 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 {
if (&tag == null) { /* bgo #591673 */
string junk;
@@ -68,33 +86,121 @@ namespace DConf {
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
+ *
+ * Writes 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;
}
- public bool set_lock (string key, bool locked, Cancellable? cancellable = null) throws Error {
- call_sync (engine.set_lock (key, locked), null, cancellable);
+ /**
+ * dconf_client_set_locked:
+ * @client: a #DConfClient
+ * @path: a dconf path
+ * @locked: %TRUE to lock, %FALSE to unlock
+ * @cancellable: a #GCancellable, or %NULL
+ * @error: a pointer to a #GError, or %NULL
+ * @returns: %TRUE if setting the lock was successful
+ *
+ * Marks a dconf path as being locked.
+ *
+ * Locks do not affect writes to this #DConfClient. You can still write to a key that is marked as
+ * being locked without problems.
+ *
+ * Locks are only effective when they are set on a database that is being used as the source of
+ * default/mandatory values. In that case, the lock will prevent writes from occuring to the database
+ * that has this database as its defaults.
+ **/
+ public bool set_locked (string path, bool locked, Cancellable? cancellable = null) throws Error {
+ call_sync (engine.set_locked (path, locked), null, cancellable);
return true;
}
- public async bool set_lock_async (string key, bool locked, Cancellable? cancellable = null) throws Error {
- yield call_async (engine.set_lock (key, locked), null, cancellable);
+ /**
+ * dconf_client_set_locked_async:
+ * @client: a #DConfClient
+ * @path: a dconf path
+ * @locked: %TRUE to lock, %FALSE to unlock
+ * @cancellable: a #GCancellable, or %NULL
+ * @callback: the function to call when complete
+ * @user_data: the user data for @callback
+ *
+ * Marks a dconf path as being locked.
+ *
+ * This is the asynchronous version of dconf_client_set_locked(). You should call
+ * dconf_client_write_finish() from @callback to collect the result.
+ **/
+ public async bool set_locked_async (string key, bool locked, Cancellable? cancellable = null) throws Error {
+ yield call_async (engine.set_locked (key, locked), null, cancellable);
return true;
}
+ /**
+ * @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);
}
@@ -130,6 +236,21 @@ namespace DConf {
}
}
+ /**
+ * 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.set_service_func (service_func);
diff --git a/client/engine.vapi b/client/engine.vapi
index b0a6909..bf955c5 100644
--- a/client/engine.vapi
+++ b/client/engine.vapi
@@ -7,7 +7,7 @@ namespace DConf {
internal GLib.Variant? read (string key);
internal GLib.Variant? read_default (string key);
internal GLib.Variant? read_no_default (string key);
- internal EngineMessage set_lock (string key, bool locked);
+ internal EngineMessage set_locked (string key, bool locked);
internal string[] list (string dir, void*junk = null);
internal static void set_service_func (ServiceFunc func);
internal EngineMessage watch (string name);
diff --git a/common/dconf-paths.c b/common/dconf-paths.c
index f31bab3..8a63704 100644
--- a/common/dconf-paths.c
+++ b/common/dconf-paths.c
@@ -83,6 +83,7 @@
/**
* dconf_is_path:
* @string: a string
+ * @error: a pointer to a #GError, or %NULL, set when %FALSE is returned
* Returns: %TRUE if @string is a path
*
* Checks if @string is a valid dconf path. dconf keys must start with
@@ -103,6 +104,7 @@ dconf_is_path (const gchar *string,
/**
* dconf_is_key:
* @string: a string
+ * @error: a pointer to a #GError, or %NULL, set when %FALSE is returned
* Returns: %TRUE if @string is a key
*
* Checks if @string is a valid dconf key. dconf keys must start with
@@ -127,6 +129,7 @@ dconf_is_key (const gchar *string,
/**
* dconf_is_dir:
* @string: a string
+ * @error: a pointer to a #GError, or %NULL, set when %FALSE is returned
* Returns: %TRUE if @string is a dir
*
* Checks if @string is a valid dconf dir. dconf dirs must start and
@@ -152,6 +155,7 @@ dconf_is_dir (const gchar *string,
/**
* dconf_is_rel:
* @string: a string
+ * @error: a pointer to a #GError, or %NULL, set when %FALSE is returned
* Returns: %TRUE if @string is a relative path
*
* Checks if @string is a valid dconf relative path. A relative path is
@@ -174,6 +178,7 @@ dconf_is_rel (const gchar *string,
/**
* dconf_is_rel_key:
* @string: a string
+ * @error: a pointer to a #GError, or %NULL, set when %FALSE is returned
* Returns: %TRUE if @string is a relative key
*
* Checks if @string is a valid dconf relative key. A relative key is a
@@ -197,6 +202,7 @@ dconf_is_rel_key (const gchar *string,
/**
* dconf_is_rel_dir:
* @string: a string
+ * @error: a pointer to a #GError, or %NULL, set when %FALSE is returned
* Returns: %TRUE if @string is a relative dir
*
* Checks if @string is a valid dconf relative dir. A relative dir is a
diff --git a/configure.ac b/configure.ac
index bcb1d46..b2b5e00 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,7 +18,7 @@ AM_PROG_VALAC([0.9.2])
GOBJECT_INTROSPECTION_CHECK([0.9.3])
# Gtk-doc support
-GTK_DOC_CHECK([1.14])
+GTK_DOC_CHECK([1.15])
# Dependencies
PKG_CHECK_MODULES(gio, gio-2.0 >= 2.25.12)
diff --git a/docs/Makefile.am b/docs/Makefile.am
index be835d0..4e11f65 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -4,7 +4,7 @@ DOC_MODULE = dconf
DOC_MAIN_SGML_FILE = dconf-docs.xml
-DOC_SOURCE_DIR = ..
+DOC_SOURCE_DIR = ../client ../common
MKDB_OPTIONS = --output-format=xml
@@ -13,6 +13,7 @@ GTKDOC_LIBS = $(gio_LIBS) -L../client -ldconf -Wl,-rpath=../client
IGNORE_HFILES = \
dconf-engine.h \
+ dconf-shmdir.h \
dconf-resetlist.h \
dconf-readtype.h \
dconf-rebuilder.h \
diff --git a/docs/dconf-sections.txt b/docs/dconf-sections.txt
index d26085a..ae4b1b2 100644
--- a/docs/dconf-sections.txt
+++ b/docs/dconf-sections.txt
@@ -4,8 +4,6 @@ DConfClientClass
DConfClient
DConfWatchFunc
dconf_client_new
-dconf_client_new_async
-dconf_client_new_finish
dconf_client_read
dconf_client_read_default
dconf_client_read_no_default
diff --git a/engine/dconf-engine.c b/engine/dconf-engine.c
index e783f72..4960c4c 100644
--- a/engine/dconf-engine.c
+++ b/engine/dconf-engine.c
@@ -548,12 +548,12 @@ dconf_engine_write_many (DConfEngine *engine,
}
void
-dconf_engine_set_lock (DConfEngine *engine,
- const gchar *path,
- gboolean locked,
- DConfEngineMessage *dcem)
+dconf_engine_set_locked (DConfEngine *engine,
+ const gchar *path,
+ gboolean locked,
+ DConfEngineMessage *dcem)
{
- dconf_engine_dcem (engine, dcem, "SetLock", "(sb)", path, locked);
+ dconf_engine_dcem (engine, dcem, "SetLocked", "(sb)", path, locked);
}
gchar **
diff --git a/engine/dconf-engine.h b/engine/dconf-engine.h
index 90580d3..5cc2a09 100644
--- a/engine/dconf-engine.h
+++ b/engine/dconf-engine.h
@@ -99,7 +99,7 @@ gboolean dconf_engine_decode_notify (DConfEn
const gchar *interface,
const gchar *member,
GVariant *body);
-void dconf_engine_set_lock (DConfEngine *engine,
+void dconf_engine_set_locked (DConfEngine *engine,
const gchar *path,
gboolean locked,
DConfEngineMessage *message);
diff --git a/service/dconf-interfaces.c b/service/dconf-interfaces.c
index 87ecad1..cac039c 100644
--- a/service/dconf-interfaces.c
+++ b/service/dconf-interfaces.c
@@ -34,8 +34,8 @@ static const GDBusArgInfo *write_out[] = { &tag_arg, NULL };
static const GDBusArgInfo *many_in[] = { &path_arg, &values_arg, NULL };
static const GDBusArgInfo *many_out[] = { &tag_arg, NULL };
static const GDBusArgInfo *notify_args[] = { &path_arg, &names_arg, &tag_arg, NULL };
-static const GDBusArgInfo *setlock_in[] = { &name_arg, &locked_arg, NULL };
-static const GDBusArgInfo *setlock_out[] = { NULL };
+static const GDBusArgInfo *setlocked_in[] = { &name_arg, &locked_arg, NULL };
+static const GDBusArgInfo *setlocked_out[] = { NULL };
static const GDBusMethodInfo write_method = {
-1, (gchar *) "Write",
@@ -49,10 +49,10 @@ static const GDBusMethodInfo writemany_method = {
(GDBusArgInfo **) many_out
};
-static const GDBusMethodInfo setlock_method = {
- -1, (gchar *) "SetLock",
- (GDBusArgInfo **) setlock_in,
- (GDBusArgInfo **) setlock_out
+static const GDBusMethodInfo setlocked_method = {
+ -1, (gchar *) "SetLocked",
+ (GDBusArgInfo **) setlocked_in,
+ (GDBusArgInfo **) setlocked_out
};
static const GDBusSignalInfo notify_signal = {
@@ -65,7 +65,7 @@ static const GDBusPropertyInfo shmdir_property = {
};
static const GDBusMethodInfo *writer_methods[] = {
- &write_method, &writemany_method, &setlock_method, NULL
+ &write_method, &writemany_method, &setlocked_method, NULL
};
static const GDBusSignalInfo *writer_signals[] = {
diff --git a/service/service.c b/service/service.c
index 30512bd..7f351e5 100644
--- a/service/service.c
+++ b/service/service.c
@@ -245,7 +245,7 @@ method_call (GDBusConnection *connection,
g_free (tag);
}
- else if (strcmp (method_name, "SetLock") == 0)
+ else if (strcmp (method_name, "SetLocked") == 0)
{
GError *error = NULL;
const gchar *name;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]