[dconf] add 'SetLock' method to the service



commit 1a472b2d9e36ae96bc1a034f38ac7172269d6b17
Author: Ryan Lortie <desrt desrt ca>
Date:   Sat Jul 17 16:08:18 2010 -0400

    add 'SetLock' method to the service
    
    Wired up internally but does nothing so far.

 service/dconf-interfaces.c |   11 ++++++++++-
 service/dconf-writer.c     |    9 +++++++++
 service/dconf-writer.h     |    4 ++++
 service/service.c          |   20 ++++++++++++++++++++
 4 files changed, 43 insertions(+), 1 deletions(-)
---
diff --git a/service/dconf-interfaces.c b/service/dconf-interfaces.c
index 08db86e..34989a7 100644
--- a/service/dconf-interfaces.c
+++ b/service/dconf-interfaces.c
@@ -6,12 +6,15 @@ static const GDBusArgInfo names_arg = { -1, (gchar *) "names", (gchar *) "as" };
 static const GDBusArgInfo serial_arg = { -1, (gchar *) "serial", (gchar *) "t" };
 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[] = { &serial_arg, NULL };
 static const GDBusArgInfo *many_in[] = { &path_arg, &values_arg, NULL };
 static const GDBusArgInfo *many_out[] = { &serial_arg, NULL };
 static const GDBusArgInfo *notify_args[] = { &path_arg, &names_arg, NULL };
+static const GDBusArgInfo *setlock_in[] = { &name_arg, &locked_arg, NULL };
+static const GDBusArgInfo *setlock_out[] = { NULL };
 
 static const GDBusMethodInfo write_method = {
   -1, (gchar *) "Write",
@@ -25,6 +28,12 @@ static const GDBusMethodInfo writemany_method = {
   (GDBusArgInfo **) many_out
 };
 
+static const GDBusMethodInfo setlock_method = {
+  -1, (gchar *) "SetLock",
+  (GDBusArgInfo **) setlock_in,
+  (GDBusArgInfo **) setlock_out
+};
+
 static const GDBusSignalInfo notify_signal = {
   -1, (gchar *) "Notify",
   (GDBusArgInfo **) notify_args
@@ -35,7 +44,7 @@ static const GDBusPropertyInfo shmdir_property = {
 };
 
 static const GDBusMethodInfo *writer_methods[] = {
-  &write_method, &writemany_method, NULL
+  &write_method, &writemany_method, &setlock_method, NULL
 };
 
 static const GDBusSignalInfo *writer_signals[] = {
diff --git a/service/dconf-writer.c b/service/dconf-writer.c
index 03a2975..b120c73 100644
--- a/service/dconf-writer.c
+++ b/service/dconf-writer.c
@@ -104,6 +104,15 @@ dconf_writer_write_many (DConfWriter          *writer,
   return TRUE;
 }
 
+gboolean
+dconf_writer_set_lock (DConfWriter  *writer,
+                       const gchar  *name,
+                       gboolean      locked,
+                       GError      **error)
+{
+  return TRUE;
+}
+
 DConfWriter *
 dconf_writer_new (const gchar *name)
 {
diff --git a/service/dconf-writer.h b/service/dconf-writer.h
index 55611b1..19b0945 100644
--- a/service/dconf-writer.h
+++ b/service/dconf-writer.h
@@ -16,3 +16,7 @@ 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);
diff --git a/service/service.c b/service/service.c
index fdbf71c..cab18e8 100644
--- a/service/service.c
+++ b/service/service.c
@@ -167,6 +167,7 @@ method_call (GDBusConnection       *connection,
                                                     serial, key, none),
                                      NULL);
     }
+
   else if (strcmp (method_name, "Merge") == 0)
     {
       GError *error = NULL;
@@ -230,6 +231,25 @@ method_call (GDBusConnection       *connection,
       g_free (values);
       g_free (keys);
     }
+
+  else if (strcmp (method_name, "SetLock") == 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]