[Multi-valued V2 (grilo) 07/12] core: Create property with an initial set of keys



Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>
---
 src/data/grl-property.c |   23 +++++++++++++++++++++++
 src/data/grl-property.h |    2 ++
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/src/data/grl-property.c b/src/data/grl-property.c
index f3d21bd..7605697 100644
--- a/src/data/grl-property.c
+++ b/src/data/grl-property.c
@@ -59,3 +59,26 @@ grl_property_new (void)
 
   return grlprop;
 }
+
+/**
+ * grl_property_new_with_keys:
+ * @related_keys: (element-type Grl.KeyID): list of keys.
+ *
+ * Creates a new place to store related keys and values.
+ *
+ * Initially it will contain the specified set of keys with no values.
+ *
+ * Returns: a new #GrlProperty
+ **/
+GrlProperty *
+grl_property_new_with_keys (const GList *keys)
+{
+  GrlProperty *prop = grl_property_new ();
+
+  while (keys) {
+    grl_data_add (GRL_DATA (prop), keys->data);
+    keys = g_list_next (keys);
+  }
+
+  return prop;
+}
diff --git a/src/data/grl-property.h b/src/data/grl-property.h
index 4628043..9b8a63d 100644
--- a/src/data/grl-property.h
+++ b/src/data/grl-property.h
@@ -94,6 +94,8 @@ GType grl_property_get_type (void) G_GNUC_CONST;
 
 GrlProperty *grl_property_new (void);
 
+GrlProperty *grl_property_new_with_keys (const GList *keys);
+
 G_END_DECLS
 
 #endif /* _GRL_PROPERTY_H_ */
-- 
1.7.4



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