[gupnp-av] Set mandatory includeDerived XML attribute
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp-av] Set mandatory includeDerived XML attribute
- Date: Thu, 16 Jun 2011 09:54:59 +0000 (UTC)
commit cc0e3d2f3630b3adc615626059b61c8d116a6bf2
Author: Jens Georg <mail jensge org>
Date: Sat Jun 4 14:33:21 2011 +0200
Set mandatory includeDerived XML attribute
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, 44 insertions(+), 8 deletions(-)
---
diff --git a/libgupnp-av/gupnp-didl-lite-container.c b/libgupnp-av/gupnp-didl-lite-container.c
index eddaf0a..dbed52c 100644
--- a/libgupnp-av/gupnp-didl-lite-container.c
+++ b/libgupnp-av/gupnp-didl-lite-container.c
@@ -338,7 +338,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.
**/
@@ -347,21 +347,52 @@ 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 8fb1958..298ab9f 100644
--- a/libgupnp-av/gupnp-didl-lite-container.h
+++ b/libgupnp-av/gupnp-didl-lite-container.h
@@ -98,10 +98,15 @@ gupnp_didl_lite_container_add_create_class
const char *create_class);
void
+gupnp_didl_lite_container_add_create_class_full
+ (GUPnPDIDLLiteContainer *container,
+ const char *create_class,
+ gboolean include_derived);
+
+void
gupnp_didl_lite_container_add_search_class
(GUPnPDIDLLiteContainer *container,
const char *search_class);
-
void
gupnp_didl_lite_container_add_search_class_full
(GUPnPDIDLLiteContainer *container,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]