[PATCH 1/5] [fake-metadata] Use the new metadata key system
- From: "Juan A. Suarez Romero" <jasuarez igalia com>
- To: grilo-list gnome org
- Subject: [PATCH 1/5] [fake-metadata] Use the new metadata key system
- Date: Mon, 7 Jun 2010 11:06:06 +0200
---
src/fake-metadata/grl-fake-metadata.c | 49 +++++++++++---------------------
1 files changed, 17 insertions(+), 32 deletions(-)
diff --git a/src/fake-metadata/grl-fake-metadata.c b/src/fake-metadata/grl-fake-metadata.c
index 25e0e17..75bb4a0 100644
--- a/src/fake-metadata/grl-fake-metadata.c
+++ b/src/fake-metadata/grl-fake-metadata.c
@@ -127,38 +127,27 @@ G_DEFINE_TYPE (GrlFakeMetadataSource,
static void
fill_metadata (GrlMedia *media, GrlKeyID key_id)
{
- switch (key_id) {
- case GRL_METADATA_KEY_AUTHOR:
+ if (key_id == GRL_METADATA_KEY_AUTHOR) {
grl_media_set_author (media, "fake author");
- break;
- case GRL_METADATA_KEY_ARTIST:
+ } else if (key_id == GRL_METADATA_KEY_ARTIST) {
grl_data_set_string (GRL_DATA (media),
GRL_METADATA_KEY_ARTIST, "fake artist");
- break;
- case GRL_METADATA_KEY_ALBUM:
+ } else if (key_id == GRL_METADATA_KEY_ALBUM) {
grl_data_set_string (GRL_DATA (media),
GRL_METADATA_KEY_ALBUM, "fake album");
- break;
- case GRL_METADATA_KEY_GENRE:
+ } else if (key_id == GRL_METADATA_KEY_GENRE) {
grl_data_set_string (GRL_DATA (media),
GRL_METADATA_KEY_GENRE, "fake genre");
- break;
- case GRL_METADATA_KEY_DESCRIPTION:
+ } else if (key_id == GRL_METADATA_KEY_DESCRIPTION) {
grl_media_set_description (media, "fake description");
- break;
- case GRL_METADATA_KEY_DURATION:
+ } else if (key_id == GRL_METADATA_KEY_DURATION) {
grl_media_set_duration (media, 99);
- break;
- case GRL_METADATA_KEY_DATE:
+ } else if (key_id == GRL_METADATA_KEY_DATE) {
grl_data_set_string (GRL_DATA (media),
GRL_METADATA_KEY_DATE, "01/01/1970");
- break;
- case GRL_METADATA_KEY_THUMBNAIL:
+ } else if (key_id == GRL_METADATA_KEY_THUMBNAIL) {
grl_media_set_thumbnail (media,
"http://fake.thumbnail.com/fake-image.jpg");
- break;
- default:
- break;
}
}
@@ -192,18 +181,15 @@ grl_fake_metadata_source_key_depends (GrlMetadataSource *source,
deps = grl_metadata_key_list_new (GRL_METADATA_KEY_TITLE, NULL);
}
- switch (key_id) {
- case GRL_METADATA_KEY_AUTHOR:
- case GRL_METADATA_KEY_ARTIST:
- case GRL_METADATA_KEY_ALBUM:
- case GRL_METADATA_KEY_GENRE:
- case GRL_METADATA_KEY_DESCRIPTION:
- case GRL_METADATA_KEY_DURATION:
- case GRL_METADATA_KEY_DATE:
- case GRL_METADATA_KEY_THUMBNAIL:
+ if (key_id == GRL_METADATA_KEY_AUTHOR ||
+ key_id == GRL_METADATA_KEY_ARTIST ||
+ key_id == GRL_METADATA_KEY_ALBUM ||
+ key_id == GRL_METADATA_KEY_GENRE ||
+ key_id == GRL_METADATA_KEY_DESCRIPTION ||
+ key_id == GRL_METADATA_KEY_DURATION ||
+ key_id == GRL_METADATA_KEY_DATE ||
+ key_id == GRL_METADATA_KEY_THUMBNAIL) {
return deps;
- default:
- break;
}
return NULL;
@@ -232,8 +218,7 @@ grl_fake_metadata_source_resolve (GrlMetadataSource *source,
iter = rs->keys;
while (iter) {
- GrlKeyID key_id = POINTER_TO_GRLKEYID (iter->data);
- fill_metadata (GRL_MEDIA (rs->media), key_id);
+ fill_metadata (GRL_MEDIA (rs->media), iter->data);
iter = g_list_next (iter);
}
--
1.7.0.4
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]