[dconf] service: add a "shm" service-db subtype



commit 4536f4014b16e4e807c4857bb23f9f6662bad6bb
Author: Ryan Lortie <desrt desrt ca>
Date:   Wed Jan 9 13:54:32 2013 -0500

    service: add a "shm" service-db subtype
    
    Add a shm service-db that does nothing.  In effect this provides us with
    a database maintained in the user runtime dir that never gets synced to
    any permanent storage.
    
    It can be used by putting a line like "service-db:shm/temp" in the dconf
    profile.

 service/Makefile.am        |    1 +
 service/dconf-service.c    |    1 +
 service/dconf-shm-writer.c |   45 ++++++++++++++++++++++++++++++++++++++++++++
 service/dconf-writer.h     |    2 +
 4 files changed, 49 insertions(+), 0 deletions(-)
---
diff --git a/service/Makefile.am b/service/Makefile.am
index 75b2a3c..7e27885 100644
--- a/service/Makefile.am
+++ b/service/Makefile.am
@@ -21,6 +21,7 @@ dconf_service_SOURCES = \
 	dconf-service.h			\
 	dconf-writer.h			\
 	dconf-writer.c			\
+	dconf-shm-writer.c		\
 	main.c
 
 dconf-generated.c: dconf-generated.h
diff --git a/service/dconf-service.c b/service/dconf-service.c
index 65e7df5..950a4cf 100644
--- a/service/dconf-service.c
+++ b/service/dconf-service.c
@@ -231,6 +231,7 @@ dconf_service_dbus_register (GApplication     *application,
   service->extension_point = g_io_extension_point_register ("dconf-backend");
   g_io_extension_point_set_required_type (service->extension_point, DCONF_TYPE_WRITER);
   g_io_extension_point_implement ("dconf-backend", DCONF_TYPE_WRITER, "Writer", 0);
+  g_io_extension_point_implement ("dconf-backend", DCONF_TYPE_SHM_WRITER, "shm", 0);
 
   service->blame = dconf_blame_get ();
   if (service->blame)
diff --git a/service/dconf-shm-writer.c b/service/dconf-shm-writer.c
new file mode 100644
index 0000000..ab18689
--- /dev/null
+++ b/service/dconf-shm-writer.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright  2010 Codethink Limited
+ * Copyright  2012 Canonical Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the licence, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Ryan Lortie <desrt desrt ca>
+ */
+
+#include "dconf-writer.h"
+
+typedef DConfWriterClass DConfShmWriterClass;
+typedef DConfWriter DConfShmWriter;
+
+G_DEFINE_TYPE (DConfShmWriter, dconf_shm_writer, DCONF_TYPE_WRITER)
+
+static void
+dconf_shm_writer_list (GHashTable *set)
+{
+}
+
+static void
+dconf_shm_writer_init (DConfWriter *writer)
+{
+  dconf_writer_set_basepath (writer, "shm");
+}
+
+static void
+dconf_shm_writer_class_init (DConfWriterClass *class)
+{
+  class->list = dconf_shm_writer_list;
+}
diff --git a/service/dconf-writer.h b/service/dconf-writer.h
index 7739ad1..4892197 100644
--- a/service/dconf-writer.h
+++ b/service/dconf-writer.h
@@ -28,6 +28,7 @@
 #include "dconf-generated.h"
 
 #define DCONF_TYPE_WRITER                                   (dconf_writer_get_type ())
+#define DCONF_TYPE_SHM_WRITER                               (dconf_shm_writer_get_type ())
 #define DCONF_WRITER(inst)                                  (G_TYPE_CHECK_INSTANCE_CAST ((inst),                     \
                                                              DCONF_TYPE_WRITER, DConfWriter))
 #define DCONF_WRITER_CLASS(class)                           (G_TYPE_CHECK_CLASS_CAST ((class),                       \
@@ -69,6 +70,7 @@ struct _DConfWriter
 
 
 GType                   dconf_writer_get_type                           (void);
+GType                   dconf_shm_writer_get_type                       (void);
 
 void                    dconf_writer_set_basepath                       (DConfWriter *writer,
                                                                          const gchar *name);



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