diff options
author | Phillip Wood <phillip.wood@dunelm.org.uk> | 2012-06-28 19:01:24 +0100 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2013-04-10 15:23:34 +0200 |
commit | 9a0561595ea27d6e3caf184c90452c5c1bf33e92 (patch) | |
tree | 5ee9329247de110f49e09f7570cf903b0b2f5450 | |
parent | 067425730bb0ded5e1cbc3860a379d6e040ce4fe (diff) |
Format recording label names.
In order to display the list of label names that we retrieve from
musicbrainz we need to convert them into one string.
https://bugzilla.gnome.org/show_bug.cgi?id=674926
-rw-r--r-- | src/sj-main.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/sj-main.c b/src/sj-main.c index 78f2159..4305b5c 100644 --- a/src/sj-main.c +++ b/src/sj-main.c @@ -783,6 +783,36 @@ static void selected_album_changed (GtkTreeSelection *selection, } /** + * Utility function to format label string for multiple_album_dialog + */ +static GString* format_label_text (GList* labels) +{ + int count; + GString *label_text; + + if (labels == NULL) + return NULL; + + label_text = g_string_new (NULL); + count = g_list_length (labels); + while (count > 2) { + g_string_append (label_text, ((LabelDetails*)labels->data)->name); + g_string_append (label_text, ", "); + labels = labels->next; + count--; + } + + if (count > 1) { + g_string_append (label_text, ((LabelDetails*)labels->data)->name); + g_string_append (label_text, " & "); + } + + g_string_append (label_text, ((LabelDetails*)labels->data)->name); + + return label_text; +} + +/** * Utility function for when there are more than one albums available */ AlbumDetails* multiple_album_dialog(GList *albums) |