[sound-juicer] Format recording label names.



commit 19c0270e1927dfff18c6044f0e0c2b06a1c9ef39
Author: Phillip Wood <phillip wood dunelm org uk>
Date:   Thu Jun 28 19:01:24 2012 +0100

    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

 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)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]