[gupnp-dlna/wip/new-api: 19/46] Add a function getting a list of GValues from GUPnPDLNAValueList.



commit ccc77d3ea9b1618377ed69f5d79036b0defab714
Author: Krzesimir Nowak <krnowak openismus com>
Date:   Thu Nov 29 19:17:57 2012 +0100

    Add a function getting a list of GValues from GUPnPDLNAValueList.
    
    That way we avoid exposing GUPnPDLNANativeValue and other guts.

 libgupnp-dlna/gupnp-dlna-value-list.c |   21 +++++++++++++++++++++
 libgupnp-dlna/gupnp-dlna-value-list.h |    3 +++
 2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/libgupnp-dlna/gupnp-dlna-value-list.c b/libgupnp-dlna/gupnp-dlna-value-list.c
index d09a229..b13a2b2 100644
--- a/libgupnp-dlna/gupnp-dlna-value-list.c
+++ b/libgupnp-dlna/gupnp-dlna-value-list.c
@@ -288,3 +288,24 @@ gupnp_dlna_value_list_sort_items (GUPnPDLNAValueList *value_list)
                 value_list->sorted = TRUE;
         }
 }
+
+GList *
+gupnp_dlna_value_list_get_g_values (GUPnPDLNAValueList *list)
+{
+        GList *g_values;
+        GList *iter;
+
+        g_return_val_if_fail (list != NULL, NULL);
+
+        g_values = NULL;
+        for (iter = list->values; iter != NULL; iter = iter->next) {
+                GValue *g_value =
+                                gupnp_dlna_native_value_to_g_value (iter->data,
+                                                                    list->type);
+
+                if (g_value)
+                        g_values = g_list_prepend (g_values, g_value);
+        }
+
+        return g_list_reverse (g_values);
+}
diff --git a/libgupnp-dlna/gupnp-dlna-value-list.h b/libgupnp-dlna/gupnp-dlna-value-list.h
index b8778e6..16218c4 100644
--- a/libgupnp-dlna/gupnp-dlna-value-list.h
+++ b/libgupnp-dlna/gupnp-dlna-value-list.h
@@ -54,6 +54,9 @@ gupnp_dlna_value_list_is_empty (GUPnPDLNAValueList *list);
 gchar *
 gupnp_dlna_value_list_to_string (GUPnPDLNAValueList *list);
 
+GList *
+gupnp_dlna_value_list_get_g_values (GUPnPDLNAValueList *list);
+
 G_END_DECLS
 
 #endif /* __GUPNP_DLNA_VALUE_LIST_H__ */



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