[rhythmbox] mpris: fix value types for integer properties
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] mpris: fix value types for integer properties
- Date: Thu, 22 Jul 2010 15:13:25 +0000 (UTC)
commit f01a6cc47981b3209eb3fb225ca9efe39e54be26
Author: Jonathan Matthew <jonathan d14n org>
Date: Fri Jul 23 01:12:10 2010 +1000
mpris: fix value types for integer properties
All of the integer properties are uint32s, except for tracknumber
and discnumber, which are strings.
plugins/mpris/rb-mpris-plugin.c | 45 ++++++++++++++++++++++++++++----------
1 files changed, 33 insertions(+), 12 deletions(-)
---
diff --git a/plugins/mpris/rb-mpris-plugin.c b/plugins/mpris/rb-mpris-plugin.c
index 102f5a8..2308650 100644
--- a/plugins/mpris/rb-mpris-plugin.c
+++ b/plugins/mpris/rb-mpris-plugin.c
@@ -200,18 +200,38 @@ add_string_property_2 (GVariantBuilder *builder,
}
static void
-add_int_property (GVariantBuilder *builder,
- RhythmDBEntry *entry,
- RhythmDBPropType prop,
- const char *name)
+add_ulong_property (GVariantBuilder *builder,
+ RhythmDBEntry *entry,
+ RhythmDBPropType prop,
+ const char *name)
{
- int v;
+ ulong v;
v = rhythmdb_entry_get_ulong (entry, prop);
- rb_debug ("adding %s = %u", name, v);
+ rb_debug ("adding %s = %lu", name, v);
g_variant_builder_add (builder,
"{sv}",
name,
- g_variant_new ("i", v));
+ g_variant_new ("u", v));
+}
+
+static void
+add_ulong_string_property (GVariantBuilder *builder,
+ RhythmDBEntry *entry,
+ RhythmDBPropType prop,
+ const char *name)
+{
+ ulong v;
+ char *str;
+
+ v = rhythmdb_entry_get_ulong (entry, prop);
+ rb_debug ("adding %s = %lu", name, v);
+
+ str = g_strdup_printf ("%lu", v);
+ g_variant_builder_add (builder,
+ "{sv}",
+ name,
+ g_variant_new ("s", str));
+ g_free (str);
}
static void
@@ -251,13 +271,14 @@ build_track_metadata (RBMprisPlugin *plugin,
add_string_property (builder, entry, RHYTHMDB_PROP_ARTIST_SORTNAME, "mb artist sort name");
add_string_property (builder, entry, RHYTHMDB_PROP_ALBUM_SORTNAME, "mb album sort name"); /* extension */
- add_int_property (builder, entry, RHYTHMDB_PROP_TRACK_NUMBER, "tracknumber");
- add_int_property (builder, entry, RHYTHMDB_PROP_DISC_NUMBER, "discnumber"); /* extension */
- add_int_property (builder, entry, RHYTHMDB_PROP_DURATION, "time");
- add_int_property (builder, entry, RHYTHMDB_PROP_BITRATE, "audio-bitrate");
- add_int_property (builder, entry, RHYTHMDB_PROP_YEAR, "year");
+ add_ulong_property (builder, entry, RHYTHMDB_PROP_DURATION, "time");
+ add_ulong_property (builder, entry, RHYTHMDB_PROP_BITRATE, "audio-bitrate");
+ add_ulong_property (builder, entry, RHYTHMDB_PROP_YEAR, "year");
/* missing: date */
+ add_ulong_string_property (builder, entry, RHYTHMDB_PROP_TRACK_NUMBER, "tracknumber");
+ add_ulong_string_property (builder, entry, RHYTHMDB_PROP_DISC_NUMBER, "discnumber"); /* extension */
+
add_double_property (builder, entry, RHYTHMDB_PROP_RATING, "rating");
md = rhythmdb_entry_request_extra_metadata (plugin->db, entry, RHYTHMDB_PROP_COVER_ART_URI);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]