[grilo] test-ui: Show "source-tags" property



commit 0defc30bd6e432cfb04c8956fef13d035d9c2178
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Feb 10 12:39:44 2014 +0100

    test-ui: Show "source-tags" property
    
    https://bugzilla.gnome.org/show_bug.cgi?id=724019

 tools/grilo-test-ui/main.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/tools/grilo-test-ui/main.c b/tools/grilo-test-ui/main.c
index 779360d..aee6cf6 100644
--- a/tools/grilo-test-ui/main.c
+++ b/tools/grilo-test-ui/main.c
@@ -917,6 +917,27 @@ media_type_to_str (GrlMediaType type)
   return g_string_free (s, FALSE);
 }
 
+static char *
+tags_to_str (char **tags)
+{
+  GString *s;
+  guint i;
+
+  if (tags == NULL)
+    return g_strdup ("");
+
+  s = g_string_new (NULL);
+
+  for (i = 0; tags[i] != NULL; i++) {
+    g_string_append (s, tags[i]);
+    g_string_append (s, ", ");
+  }
+
+  if (i > 0)
+    g_string_truncate (s, s->len - 2);
+  return g_string_free (s, FALSE);
+}
+
 static void
 populate_source_metadata (GrlSource *source)
 {
@@ -940,6 +961,7 @@ populate_source_metadata (GrlSource *source)
     int rank;
     GrlMediaType supported_media;
     GIcon *icon;
+    char **tags;
 
     for (i = 0; i < G_N_ELEMENTS (str_props); i++) {
       g_object_get (G_OBJECT (source), str_props[i], &str, NULL);
@@ -952,6 +974,7 @@ populate_source_metadata (GrlSource *source)
                   "rank", &rank,
                   "supported-media", &supported_media,
                   "source-icon", &icon,
+                  "source-tags", &tags,
                   NULL);
 
     str = g_strdup_printf ("%i", auto_split_threshold);
@@ -972,6 +995,11 @@ populate_source_metadata (GrlSource *source)
       g_free (str);
       g_object_unref (icon);
     }
+
+    str = tags_to_str (tags);
+    add_source_metadata (view->metadata_model, "source-tags", str);
+    g_free (str);
+    g_strfreev (tags);
   }
 
   gtk_widget_set_sensitive (view->show_btn, FALSE);


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