[dconf] Remove 'set lock' support from dconf



commit 83e61fdbe0b71bc20c82789b56c48e6dcd44981a
Author: Ryan Lortie <desrt desrt ca>
Date:   Sun Sep 11 12:44:36 2011 -0400

    Remove 'set lock' support from dconf
    
    The dconf service can not presently be run at the system level and it
    doesn't make sense to support locks on user-level databases.  It also
    became clear that most distributors and sysadmins would rather work
    directly with text files anyway, so we supported that directly instead.
    
    For this reason, 'set lock' support has never been properly implemented.
    
    All the plumbing was added for it though, which means we have it
    appearing on the API of the client library and documented in the help of
    the commandline tool.  This is misleading, since these functions do
    nothing at all (and actually contain bugs anyway since their
    do-nothingness was never actually tested).
    
    For now, we rip out these functions.  We can add them back later if we
    decide to support this properly.

 bin/dconf.vala             |   32 --------------------------------
 client/dconf-client.vala   |   42 ------------------------------------------
 configure.ac               |    1 +
 engine/dconf-engine.c      |    9 ---------
 engine/dconf-engine.h      |    6 ------
 service/dconf-interfaces.c |   11 +----------
 service/dconf-writer.c     |    9 ---------
 service/dconf-writer.h     |    4 ----
 service/service.c          |   18 ------------------
 9 files changed, 2 insertions(+), 130 deletions(-)
---
diff --git a/bin/dconf.vala b/bin/dconf.vala
index 6c63bd1..a25b489 100644
--- a/bin/dconf.vala
+++ b/bin/dconf.vala
@@ -59,16 +59,6 @@ void show_help (bool requested, string? command) {
 			synopsis = "";
 			break;
 
-		case "lock":
-			description = "Set a lock on a path";
-			synopsis = "PATH";
-			break;
-
-		case "unlock":
-			description = "Clear a lock on a path";
-			synopsis = "PATH";
-			break;
-
 		case "watch":
 			description = "Watch a path for key changes";
 			synopsis = "PATH";
@@ -102,8 +92,6 @@ Commands:
   write             Change the value of a key
   reset             Reset the value of a key or dir
   update            Update the system databases
-  lock              Set a lock on a path
-  unlock            Clear a lock on a path
   watch             Watch a path for changes
 
 Use 'dconf help COMMAND' to get detailed help.
@@ -207,24 +195,6 @@ void dconf_reset (string?[] args) throws Error {
 	client.write (path, null);
 }
 
-void dconf_lock (string?[] args) throws Error {
-	var client = new DConf.Client ();
-	var key = args[2];
-
-	DConf.verify_key (key);
-
-	client.set_locked (key, true);
-}
-
-void dconf_unlock (string?[] args) throws Error {
-	var client = new DConf.Client ();
-	var key = args[2];
-
-	DConf.verify_key (key);
-
-	client.set_locked (key, false);
-}
-
 void show_path (DConf.Client client, string path) {
 	if (DConf.is_key (path)) {
 		var value = client.read (path);
@@ -311,8 +281,6 @@ int main (string[] args) {
 		CommandMapping ("write",     dconf_write),
 		CommandMapping ("reset",     dconf_reset),
 		CommandMapping ("update",    dconf_update),
-		CommandMapping ("lock",      dconf_lock),
-		CommandMapping ("unlock",    dconf_unlock),
 		CommandMapping ("watch",     dconf_watch),
 		CommandMapping ("dump",      dconf_dump),
 		CommandMapping ("load",      dconf_load),
diff --git a/client/dconf-client.vala b/client/dconf-client.vala
index 940abf2..8c011ae 100644
--- a/client/dconf-client.vala
+++ b/client/dconf-client.vala
@@ -204,48 +204,6 @@ namespace DConf {
 		}*/
 
 		/**
-		 * 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;
-		}
-
-		/**
-		 * 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_set_locked_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;
-		}
-
-		/**
 		 * dconf_client_read:
 		 * @client: a #DConfClient
 		 * @key: a valid dconf key
diff --git a/configure.ac b/configure.ac
index 827540e..8d31d13 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,6 +10,7 @@ AC_CONFIG_HEADERS([config.h])
 
 AM_INIT_AUTOMAKE([1.11 -Wno-portability no-dist-gzip dist-xz])
 AM_SILENT_RULES([yes])
+GNOME_MAINTAINER_MODE_DEFINES
 
 # Check for programs
 AC_PROG_CC
diff --git a/engine/dconf-engine.c b/engine/dconf-engine.c
index 88f7e83..21105da 100644
--- a/engine/dconf-engine.c
+++ b/engine/dconf-engine.c
@@ -683,15 +683,6 @@ dconf_engine_write_many (DConfEngine          *engine,
   return TRUE;
 }
 
-void
-dconf_engine_set_locked (DConfEngine        *engine,
-                         const gchar        *path,
-                         gboolean            locked,
-                         DConfEngineMessage *dcem)
-{
-  dconf_engine_dcem (engine, dcem, "SetLocked", "(sb)", path, locked);
-}
-
 gchar **
 dconf_engine_list (DConfEngine    *engine,
                    const gchar    *dir,
diff --git a/engine/dconf-engine.h b/engine/dconf-engine.h
index 0bde8f0..98333fb 100644
--- a/engine/dconf-engine.h
+++ b/engine/dconf-engine.h
@@ -150,12 +150,6 @@ gboolean                dconf_engine_decode_writability_notify          (const g
                                                                          GVariant                *body);
 
 G_GNUC_INTERNAL
-void                    dconf_engine_set_locked                         (DConfEngine             *engine,
-                                                                         const gchar             *path,
-                                                                         gboolean                 locked,
-                                                                         DConfEngineMessage      *message);
-
-G_GNUC_INTERNAL
 gboolean                dconf_engine_interpret_reply                    (DConfEngineMessage      *message,
                                                                          const gchar             *sender,
                                                                          GVariant                *body,
diff --git a/service/dconf-interfaces.c b/service/dconf-interfaces.c
index cac039c..180f3a3 100644
--- a/service/dconf-interfaces.c
+++ b/service/dconf-interfaces.c
@@ -27,15 +27,12 @@ static const GDBusArgInfo names_arg = { -1, (gchar *) "names", (gchar *) "as" };
 static const GDBusArgInfo tag_arg = { -1, (gchar *) "tag", (gchar *) "s" };
 static const GDBusArgInfo value_arg = { -1, (gchar *) "value", (gchar *) "av" };
 static const GDBusArgInfo values_arg = { -1, (gchar *) "values", (gchar *) "a(sav)" };
-static const GDBusArgInfo locked_arg = { -1, (gchar *) "locked", (gchar *) "b" };
 
 static const GDBusArgInfo *write_in[] = { &name_arg, &value_arg, NULL };
 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 *setlocked_in[] = { &name_arg, &locked_arg, NULL };
-static const GDBusArgInfo *setlocked_out[] = { NULL };
 
 static const GDBusMethodInfo write_method = {
   -1, (gchar *) "Write",
@@ -49,12 +46,6 @@ static const GDBusMethodInfo writemany_method = {
   (GDBusArgInfo **) many_out
 };
 
-static const GDBusMethodInfo setlocked_method = {
-  -1, (gchar *) "SetLocked",
-  (GDBusArgInfo **) setlocked_in,
-  (GDBusArgInfo **) setlocked_out
-};
-
 static const GDBusSignalInfo notify_signal = {
   -1, (gchar *) "Notify",
   (GDBusArgInfo **) notify_args
@@ -65,7 +56,7 @@ static const GDBusPropertyInfo shmdir_property = {
 };
 
 static const GDBusMethodInfo *writer_methods[] = {
-  &write_method, &writemany_method, &setlocked_method, NULL
+  &write_method, &writemany_method, NULL
 };
 
 static const GDBusSignalInfo *writer_signals[] = {
diff --git a/service/dconf-writer.c b/service/dconf-writer.c
index 3b98efd..3f2aeee 100644
--- a/service/dconf-writer.c
+++ b/service/dconf-writer.c
@@ -128,15 +128,6 @@ dconf_writer_write_many (DConfWriter          *writer,
   return TRUE;
 }
 
-gboolean
-dconf_writer_set_lock (DConfWriter  *writer,
-                       const gchar  *name,
-                       gboolean      locked,
-                       GError      **error)
-{
-  return TRUE;
-}
-
 const gchar *
 dconf_writer_get_name (DConfWriter *writer)
 {
diff --git a/service/dconf-writer.h b/service/dconf-writer.h
index 4c2e6b3..c469d1b 100644
--- a/service/dconf-writer.h
+++ b/service/dconf-writer.h
@@ -41,9 +41,5 @@ gboolean                dconf_writer_write_many                         (DConfWr
                                                                          GVariant * const     *values,
                                                                          gsize n_items,
                                                                          GError              **error);
-gboolean                dconf_writer_set_lock                           (DConfWriter          *writer,
-                                                                         const gchar          *name,
-                                                                         gboolean              locked,
-                                                                         GError              **error);
 
 #endif /* __dconf_writer_h__ */
diff --git a/service/service.c b/service/service.c
index 99051ec..407f8a1 100644
--- a/service/service.c
+++ b/service/service.c
@@ -280,24 +280,6 @@ method_call (GDBusConnection       *connection,
       g_free (tag);
     }
 
-  else if (strcmp (method_name, "SetLocked") == 0)
-    {
-      GError *error = NULL;
-      const gchar *name;
-      gboolean locked;
-
-      g_variant_get (parameters, "(&sb)", &name, &locked);
-
-      if (!dconf_writer_set_lock (writer, name, locked, &error))
-        {
-          g_dbus_method_invocation_return_gerror (invocation, error);
-          g_error_free (error);
-          return;
-        }
-
-      g_dbus_method_invocation_return_value (invocation, NULL);
-    }
-
   else
     g_assert_not_reached ();
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]