[grilo] Revert "core: Allow removing metadata keys in GrlData"
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo] Revert "core: Allow removing metadata keys in GrlData"
- Date: Wed, 10 Dec 2014 23:37:49 +0000 (UTC)
commit e0e30dfa0ea5d9e4814b2cdb1236abfa74289076
Author: Bastien Nocera <hadess hadess net>
Date: Thu Dec 11 00:34:49 2014 +0100
Revert "core: Allow removing metadata keys in GrlData"
This reverts commit 32275f8daace57eaea1899ad534244091e05e0a9.
This patch broke adding empty strings as related keys, as the
lastfm-albumart plugin tests showed.
https://bugzilla.gnome.org/show_bug.cgi?id=741207
src/data/grl-data.c | 6 ++++--
src/data/grl-related-keys.c | 12 +++++-------
2 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/src/data/grl-data.c b/src/data/grl-data.c
index 9f9aba2..b453694 100644
--- a/src/data/grl-data.c
+++ b/src/data/grl-data.c
@@ -194,6 +194,10 @@ grl_data_set (GrlData *data, GrlKeyID key, const GValue *value)
g_return_if_fail (GRL_IS_DATA (data));
g_return_if_fail (key);
+ if (!value) {
+ return;
+ }
+
/* Get the right set of related keys */
if (grl_data_length (data, key) > 0) {
relkeys = grl_data_get_related_keys (data, key, 0);
@@ -236,8 +240,6 @@ grl_data_set_string (GrlData *data,
g_value_set_string (&value, strvalue);
grl_data_set (data, key, &value);
g_value_unset (&value);
- } else {
- grl_data_set (data, key, NULL);
}
}
diff --git a/src/data/grl-related-keys.c b/src/data/grl-related-keys.c
index feb0a7f..2bde3c0 100644
--- a/src/data/grl-related-keys.c
+++ b/src/data/grl-related-keys.c
@@ -242,20 +242,18 @@ grl_related_keys_set (GrlRelatedKeys *relkeys,
g_return_if_fail (GRL_IS_RELATED_KEYS (relkeys));
g_return_if_fail (key);
+ if (!value) {
+ return;
+ }
+
/* Dup value */
- if (value != NULL &&
- G_VALUE_TYPE (value) != GRL_METADATA_KEY_GET_TYPE (key)) {
+ if (G_VALUE_TYPE (value) != GRL_METADATA_KEY_GET_TYPE (key)) {
GRL_WARNING ("value has type %s, but expected %s",
g_type_name (G_VALUE_TYPE (value)),
g_type_name (GRL_METADATA_KEY_GET_TYPE (key)));
return;
}
- if (!value) {
- g_hash_table_remove (relkeys->priv->data, GRLKEYID_TO_POINTER (key));
- return;
- }
-
copy = g_new0 (GValue, 1);
g_value_init (copy, G_VALUE_TYPE (value));
g_value_copy (value, copy);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]