[glib/new-gsettings] Add an --allow-any-name option



commit 9970c6854a3e9ba12deeb9fa9ba83113bf3617d4
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Apr 16 12:53:33 2010 -0400

    Add an --allow-any-name option
    
    This will make it easier for people to keep their GConf key names
    in the transition period.

 docs/reference/gio/gschema-compile.xml |   10 ++++++++++
 gio/gschema-compile.c                  |    6 ++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gio/gschema-compile.xml b/docs/reference/gio/gschema-compile.xml
index 1dcc643..db68210 100644
--- a/docs/reference/gio/gschema-compile.xml
+++ b/docs/reference/gio/gschema-compile.xml
@@ -43,6 +43,16 @@ Print help and exit
 Store <filename>gschemas.compiled</filename> in <replaceable>TARGETDIR</replaceable> instead of <replaceable>directory</replaceable>.
 </para></listitem>
 </varlistentry>
+
+<varlistentry>
+<term><option>--allow-any-name</option></term>
+<listitem><para>
+Do not enforce restrictions on key names. Note that this option is purely
+to facility the transition from GConf, and will be removed at some time
+in the future.
+</para></listitem>
+</varlistentry>
+
 </variablelist>
 </refsect2>
 </refsect1>
diff --git a/gio/gschema-compile.c b/gio/gschema-compile.c
index c074c4a..405ffa7 100644
--- a/gio/gschema-compile.c
+++ b/gio/gschema-compile.c
@@ -49,6 +49,8 @@ typedef struct
   GVariantType *type;
 } ParseState;
 
+static gboolean allow_any_name = FALSE;
+
 static gboolean
 is_valid_keyname (const gchar  *key,
                   GError      **error)
@@ -62,6 +64,9 @@ is_valid_keyname (const gchar  *key,
       return FALSE;
     }
 
+  if (allow_any_name)
+    return TRUE;
+
   if (!g_ascii_islower (key[0]))
     {
       g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
@@ -479,6 +484,7 @@ main (int argc, char **argv)
   GOptionContext *context;
   GOptionEntry entries[] = {
     { "targetdir", 0, 0, G_OPTION_ARG_FILENAME, &targetdir, "where to store the gschemas.compiled file", "DIRECTORY" },
+    { "allow-any-name", 0, 0, G_OPTION_ARG_NONE, &allow_any_name, "do not enforce key name restrictions" },
     { NULL }
   };
 



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