[PATCH] Set mandatory includeDerived XML attribute
- From: Jens Georg <mail jensge org>
- To: gupnp-list gnome org
- Subject: [PATCH] Set mandatory includeDerived XML attribute
- Date: Sat, 4 Jun 2011 14:34:02 +0200
includeDerived is mandatory for upnp:createClass.
---
libgupnp-av/gupnp-didl-lite-container.c | 45 ++++++++++++++++++++++++++-----
libgupnp-av/gupnp-didl-lite-container.h | 7 +++++
2 files changed, 45 insertions(+), 7 deletions(-)
diff --git a/libgupnp-av/gupnp-didl-lite-container.c b/libgupnp-av/gupnp-didl-lite-container.c
index b2f190d..00bcd96 100644
--- a/libgupnp-av/gupnp-didl-lite-container.c
+++ b/libgupnp-av/gupnp-didl-lite-container.c
@@ -298,7 +298,7 @@ gupnp_didl_lite_container_set_child_count (GUPnPDIDLLiteContainer *container,
* @container: #GUPnPDIDLLiteContainer
* @create_class: The createClass to add.
*
- * Add a new create class to the @object.
+ * Add a new create class to the @object. includeDerived defaults to "0".
*
* Return value: None.
**/
@@ -307,19 +307,50 @@ gupnp_didl_lite_container_add_create_class (
GUPnPDIDLLiteContainer *container,
const char *create_class)
{
- xmlNode *xml_node;
+ gupnp_didl_lite_container_add_create_class_full (container,
+ create_class,
+ FALSE);
+}
+
+/**
+ * gupnp_didl_lite_container_add_create_class_full:
+ * @container: #GUPnPDIDLLiteContainer
+ * @create_class: The createClass to add.
+ * @include_derived: Whether object with dervied classes may be created in
+ * this container or not.
+ *
+ * Add a new create class to the @object.
+ *
+ * Return value: None.
+ **/
+void
+gupnp_didl_lite_container_add_create_class_full (
+ GUPnPDIDLLiteContainer *container,
+ const char *create_class,
+ gboolean include_derived)
+{
+ xmlNode *container_node, *new_node;
xmlNs *namespace;
+ const char *str;
g_return_if_fail (container != NULL);
g_return_if_fail (GUPNP_IS_DIDL_LITE_CONTAINER (container));
- xml_node = gupnp_didl_lite_object_get_xml_node
+ container_node = gupnp_didl_lite_object_get_xml_node
(GUPNP_DIDL_LITE_OBJECT (container));
namespace = gupnp_didl_lite_object_get_upnp_namespace
(GUPNP_DIDL_LITE_OBJECT (container));
- xmlNewChild (xml_node,
- namespace,
- (unsigned char *) "createClass",
- (unsigned char *) create_class);
+ new_node = xmlNewChild (container_node,
+ namespace,
+ (unsigned char *) "createClass",
+ (unsigned char *) create_class);
+ if (include_derived)
+ str = "1";
+ else
+ str = "0";
+
+ xmlSetProp (new_node,
+ (unsigned char *) "includeDerived",
+ (unsigned char *) str);
}
diff --git a/libgupnp-av/gupnp-didl-lite-container.h b/libgupnp-av/gupnp-didl-lite-container.h
index 082915e..e632f9a 100644
--- a/libgupnp-av/gupnp-didl-lite-container.h
+++ b/libgupnp-av/gupnp-didl-lite-container.h
@@ -93,6 +93,13 @@ gupnp_didl_lite_container_add_create_class
(GUPnPDIDLLiteContainer *container,
const char *create_class);
+void
+gupnp_didl_lite_container_add_create_class_full
+ (GUPnPDIDLLiteContainer *container,
+ const char *create_class,
+ gboolean include_derived);
+
+
G_END_DECLS
#endif /* __GUPNP_DIDL_LITE_CONTAINER_H__ */
--
1.7.5.2
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]