[glib/gsettings] Emit 'list' into schema cache for GSettingsLists



commit 1a306ba6a4bb4da6e5bc4f2c0dd224cab21bf805
Author: Ryan Lortie <desrt desrt ca>
Date:   Wed Sep 2 00:33:19 2009 -0400

    Emit 'list' into schema cache for GSettingsLists

 gio/gsettings-update-schema-cache.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/gio/gsettings-update-schema-cache.c b/gio/gsettings-update-schema-cache.c
index 0082faf..a34ba85 100644
--- a/gio/gsettings-update-schema-cache.c
+++ b/gio/gsettings-update-schema-cache.c
@@ -603,6 +603,13 @@ read_schema (TokenStream *stream,
           break;
 
         case TOKEN_KEY:
+          if (schema->is_list)
+            {
+              token_stream_error (stream,
+                                  "lists may not directly contain keys");
+              goto fail;
+            }
+
           read_key (stream, schema->keys);
           break;
 
@@ -697,7 +704,14 @@ serialise_schema (Schema *schema)
   g_hash_table_foreach (schema->children, append_children_entry, children);
 
   if (schema->is_list)
-    g_variant_builder_add (parents, "s", "list");
+    {
+      GVariant *entry;
+
+      g_assert (g_hash_table_size (schema->keys) == 0);
+      entry = g_variant_parsef ("{'list', ('as', <@as []>)}");
+      g_variant_builder_add_value (keys, entry);
+      g_variant_builder_add (parents, "s", "list");
+    }
 
   return g_variant_new ("(asmsa{s(sv)}a{ss})",
                         parents, schema->base_path, keys, children);



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