[core 4/7] core: Fix grl_data_get_keys() function
- From: "Juan A. Suarez Romero" <jasuarez igalia com>
- To: grilo-list gnome org
- Subject: [core 4/7] core: Fix grl_data_get_keys() function
- Date: Wed, 30 Mar 2011 11:15:24 +0200
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);
--
1.7.4
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]