[grilo/debian: 20/23] test-ui: Do not show empty values



commit b906053fdbabada407c9b89bced0edf35255eb82
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Fri Mar 4 16:55:32 2011 +0000

    test-ui: Do not show empty values
    
    Do not print keys that do not have a value.
    
    Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>

 tools/grilo-test-ui/main.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/tools/grilo-test-ui/main.c b/tools/grilo-test-ui/main.c
index 2b5109e..186e300 100644
--- a/tools/grilo-test-ui/main.c
+++ b/tools/grilo-test-ui/main.c
@@ -541,15 +541,18 @@ metadata_cb (GrlMediaSource *source,
     keys = grl_data_get_keys (GRL_DATA (media));
     i = keys;
     while (i) {
-      const GValue *g_value = grl_data_get (GRL_DATA (media), i->data);
-      gchar *value = g_value ? g_strdup_value_contents (g_value) : "";
-      gtk_list_store_append (GTK_LIST_STORE (view->metadata_model), &iter);
-      gtk_list_store_set (GTK_LIST_STORE (view->metadata_model),
-			  &iter,
-			  METADATA_MODEL_NAME, GRL_METADATA_KEY_GET_NAME (i->data),
-			  METADATA_MODEL_VALUE, value,
-			  -1);
-      GRL_DEBUG ("  %s: %s", GRL_METADATA_KEY_GET_NAME (i->data), value);
+      if (grl_data_key_is_known (GRL_DATA (media), i->data)) {
+        const GValue *g_value = grl_data_get (GRL_DATA (media), i->data);
+        gchar *value = g_value ? g_strdup_value_contents (g_value) : "";
+        gtk_list_store_append (GTK_LIST_STORE (view->metadata_model), &iter);
+        gtk_list_store_set (GTK_LIST_STORE (view->metadata_model),
+                            &iter,
+                            METADATA_MODEL_NAME,
+                            GRL_METADATA_KEY_GET_NAME (i->data),
+                            METADATA_MODEL_VALUE, value,
+                            -1);
+        GRL_DEBUG ("  %s: %s", GRL_METADATA_KEY_GET_NAME (i->data), value);
+      }
       i = g_list_next (i);
     }
 



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