[dconf/wip/varlib: 8/12] engine: add support for 'file-db'



commit cf82cfdda2c561e517501a5742b780ca9d538c1b
Author: Ryan Lortie <desrt desrt ca>
Date:   Sun Dec 1 21:56:25 2013 -0500

    engine: add support for 'file-db'
    
    This is a new database type that is simply an absolute path to a gvdb
    anywhere on the filesystem.  Change notification is not supported.
    
    This is intended to be used by things like gdm that wish to install
    databases (somewhere in /usr) as part of the software.

 engine/Makefile.am                   |    1 +
 engine/dconf-engine-profile.c        |   14 +++++++-------
 engine/dconf-engine-source-private.h |    1 +
 engine/dconf-engine-source.c         |    4 ++++
 4 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/engine/Makefile.am b/engine/Makefile.am
index 5266f27..0f200d5 100644
--- a/engine/Makefile.am
+++ b/engine/Makefile.am
@@ -8,6 +8,7 @@ libdconf_engine_a_SOURCES = \
        dconf-engine-profile.c          \
        dconf-engine-source-private.h   \
        dconf-engine-source.h           \
+       dconf-engine-source-file.c      \
        dconf-engine-source-user.c      \
        dconf-engine-source-service.c   \
        dconf-engine-source-system.c    \
diff --git a/engine/dconf-engine-profile.c b/engine/dconf-engine-profile.c
index 8cd6e0d..5dc73eb 100644
--- a/engine/dconf-engine-profile.c
+++ b/engine/dconf-engine-profile.c
@@ -64,14 +64,14 @@
  * Once a profile file is opened, each line is treated as a possible
  * source.  Comments and empty lines are ignored.
  *
- * All valid source specification lines need to start with 'user-db:' or
- * 'system-db:'.  If a line doesn't start with one of these then it gets
- * ignored.  If all the lines in the file get ignored then the result is
- * effectively the null profile.
+ * All valid source specification lines need to start with 'user-db:',
+ * 'system-db:', 'service-db:' or 'file-db:'.  If a line doesn't start
+ * with one of these then it gets ignored.  If all the lines in the file
+ * get ignored then the result is effectively the null profile.
  *
- * If the first source is a "user-db:" then the resulting profile will
- * be writable.  No profile starting with a "system-db:" source can ever
- * be writable.
+ * If the first source is a "user-db:" or "service-db:" then the
+ * resulting profile will be writable.  No profile starting with a
+ * "system-db:" or "file-db:" source can ever be writable.
  *
  * Note: even if the source fails to initialise (due to a missing file,
  * for example) it will remain in the source list.  This could have a
diff --git a/engine/dconf-engine-source-private.h b/engine/dconf-engine-source-private.h
index e0b943d..d209d28 100644
--- a/engine/dconf-engine-source-private.h
+++ b/engine/dconf-engine-source-private.h
@@ -25,6 +25,7 @@
 
 #include "dconf-engine-source.h"
 
+G_GNUC_INTERNAL extern const DConfEngineSourceVTable dconf_engine_source_file_vtable;
 G_GNUC_INTERNAL extern const DConfEngineSourceVTable dconf_engine_source_user_vtable;
 G_GNUC_INTERNAL extern const DConfEngineSourceVTable dconf_engine_source_service_vtable;
 G_GNUC_INTERNAL extern const DConfEngineSourceVTable dconf_engine_source_system_vtable;
diff --git a/engine/dconf-engine-source.c b/engine/dconf-engine-source.c
index 9a34a01..e6701f4 100644
--- a/engine/dconf-engine-source.c
+++ b/engine/dconf-engine-source.c
@@ -106,6 +106,10 @@ dconf_engine_source_new (const gchar *description)
   else if ((colon == description + 9) && memcmp (description, "system-db", 9) == 0)
     vtable = &dconf_engine_source_system_vtable;
 
+  /* ...or "file-db" */
+  else if ((colon == description + 7) && memcmp (description, "file-db", 7) == 0)
+    vtable = &dconf_engine_source_file_vtable;
+
   /* If it's not any of those, we have failed. */
   else
     return NULL;


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