[grilo] core: Fix grl_data_get_keys() function



commit 98281b32f637d76d0fb0bb6b0a8691b69c0f634a
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Wed Mar 30 09:48:17 2011 +0200

    core: Fix grl_data_get_keys() function
    
    Return only those keys that are in GrlData (keys that have at least one
    value).
    
    Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>

 src/data/grl-data.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/data/grl-data.c b/src/data/grl-data.c
index e37c061..b5a134e 100644
--- a/src/data/grl-data.c
+++ b/src/data/grl-data.c
@@ -574,20 +574,23 @@ grl_data_get_keys (GrlData *data)
 {
   GList *allkeys = NULL;
   GList *keylist, *key;
-  GList *relkeys;
   GrlPluginRegistry *registry;
+  const GList *relkeys;
 
   g_return_val_if_fail (GRL_IS_DATA (data), NULL);
 
   keylist = g_hash_table_get_keys (data->priv->data);
   registry = grl_plugin_registry_get_default ();
 
-  /* Include also all related keys */
   for (key = keylist; key; key = g_list_next (key)) {
-    relkeys =
-      g_list_copy ((GList *) grl_plugin_registry_lookup_metadata_key_relation (registry,
-                                                                               key->data));
-    allkeys = g_list_concat (allkeys, relkeys);
+    relkeys = grl_plugin_registry_lookup_metadata_key_relation (registry,
+                                                                key->data);
+    while (relkeys) {
+      if (grl_data_has_key (data, relkeys->data)) {
+        allkeys = g_list_prepend (allkeys, relkeys->data);
+      }
+      relkeys = g_list_next (relkeys);
+    }
   }
 
   g_list_free (keylist);



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