[rygel-grilo] Add get_item_type_as_string() function



commit 3d0bb343a1fe601df44f6c89e7b3963bac76b64b
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Thu May 13 11:22:27 2010 +0200

    Add get_item_type_as_string() function
    
    Returns 'Type' property value, as string (container, audio, ...).

 lib/media-server1-client.c |   23 +++++++++++++++++++++++
 lib/media-server1-client.h |    2 ++
 2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/lib/media-server1-client.c b/lib/media-server1-client.c
index 9f9252e..675ac4c 100644
--- a/lib/media-server1-client.c
+++ b/lib/media-server1-client.c
@@ -686,6 +686,29 @@ ms1_client_get_item_type (GHashTable *properties)
 }
 
 /**
+ * ms1_client_get_item_type_string:
+ * @properties: a #GHashTable
+ *
+ * Returns "Type" property value as a string.
+ *
+ * Returns: property value or @NULL if it is not available
+ **/
+const gchar *
+ms1_client_get_item_type_string (GHashTable *properties)
+{
+  GValue *val;
+
+  g_return_val_if_fail (properties, NULL);
+
+  val = g_hash_table_lookup (properties, MS1_PROP_TYPE);
+  if (!val || !G_VALUE_HOLDS_STRING (val)) {
+    return NULL;
+  }
+
+  return g_value_get_string (val);
+}
+
+/**
  * ms1_client_get_mime_type:
  * @properties: a #GHashTable
  *
diff --git a/lib/media-server1-client.h b/lib/media-server1-client.h
index 81fc312..3a41b1e 100644
--- a/lib/media-server1-client.h
+++ b/lib/media-server1-client.h
@@ -116,6 +116,8 @@ const gchar *ms1_client_get_display_name (GHashTable *properties);
 
 MS1ItemType ms1_client_get_item_type (GHashTable *properties);
 
+const gchar *ms1_client_get_item_type_string (GHashTable *properties);
+
 const gchar *ms1_client_get_mime_type (GHashTable *properties);
 
 const gchar *ms1_client_get_artist (GHashTable *properties);



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