Mercurial > audlegacy
changeset 3900:44ab3d6057da
implement audacious_get_tuple_field_data().
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Tue, 06 Nov 2007 12:23:24 -0600 |
parents | 2c768d923bcf |
children | 2bb32f15569e |
files | src/libaudclient/audctrl.c |
diffstat | 1 files changed, 29 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/libaudclient/audctrl.c Tue Nov 06 11:52:01 2007 -0600 +++ b/src/libaudclient/audctrl.c Tue Nov 06 12:23:24 2007 -0600 @@ -964,8 +964,34 @@ **/ gchar *audacious_get_tuple_field_data(DBusGProxy *proxy, gchar *field, guint pos) { -//XXX - g_clear_error(&error); - return NULL; + GValue value; + gchar *s = NULL; + + org_atheme_audacious_song_tuple(proxy, pos, field, &value, &error); + + g_clear_error(&error); + + if (G_IS_VALUE(&value) == FALSE) + return NULL; + + if (G_VALUE_HOLDS_STRING(&value)) + s = g_strescape(g_value_get_string(&value), NULL); + else if (g_value_type_transformable(G_VALUE_TYPE(&value), G_TYPE_STRING)) + { + GValue tmp_value = {}; + + g_value_init(&tmp_value, G_TYPE_STRING); + g_value_transform(&value, &tmp_value); + + s = g_strescape(g_value_get_string(&tmp_value), NULL); + + g_value_unset(&tmp_value); + } + else + s = g_strdup("<unknown type>"); + + g_value_unset(&value); + + return s; }