[grilo] core: Fix grl_data_has_key() function



commit 893bacf1e6b5a5eccf37af034cb8dc649e38b0c1
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Wed Mar 30 09:40:28 2011 +0200

    core: Fix grl_data_has_key() function
    
    Check if key has at least one value in data.
    
    Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>

 src/data/grl-data.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/data/grl-data.c b/src/data/grl-data.c
index 7a0a988..0f5f0ac 100644
--- a/src/data/grl-data.c
+++ b/src/data/grl-data.c
@@ -537,7 +537,9 @@ grl_data_remove (GrlData *data, GrlKeyID key)
 gboolean
 grl_data_has_key (GrlData *data, GrlKeyID key)
 {
+  GList *related_keys;
   GrlKeyID sample_key;
+  gboolean found = FALSE;
 
   g_return_val_if_fail (GRL_IS_DATA (data), FALSE);
 
@@ -546,7 +548,13 @@ grl_data_has_key (GrlData *data, GrlKeyID key)
     return FALSE;
   }
 
-  return g_hash_table_lookup_extended (data->priv->data, sample_key, NULL, NULL);
+  related_keys = g_hash_table_lookup (data->priv->data, sample_key);
+  while (related_keys && !found) {
+    found = grl_related_keys_has_key (related_keys->data, key);
+    related_keys = g_list_next (related_keys);
+  }
+
+  return found;
 }
 
 /**



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