[gupnp-av] Add totalDeletedChildCount to GUPnPDIDLLiteContainer.



commit a260fe297cf23389f8398a03e7c2e467070b7655
Author: Krzesimir Nowak <krnowak openismus com>
Date:   Fri Sep 7 15:25:16 2012 +0200

    Add totalDeletedChildCount to GUPnPDIDLLiteContainer.
    
    Will be needed for Tracking Changes Option of ContentDirectory.

 libgupnp-av/gupnp-didl-lite-container.c |  141 ++++++++++++++++++++++++++++++-
 libgupnp-av/gupnp-didl-lite-container.h |   17 ++++
 2 files changed, 157 insertions(+), 1 deletions(-)
---
diff --git a/libgupnp-av/gupnp-didl-lite-container.c b/libgupnp-av/gupnp-didl-lite-container.c
index 14a9226..b7c9aba 100644
--- a/libgupnp-av/gupnp-didl-lite-container.c
+++ b/libgupnp-av/gupnp-didl-lite-container.c
@@ -44,7 +44,8 @@ enum {
         PROP_SEARCHABLE,
         PROP_CHILD_COUNT,
         PROP_STORAGE_USED,
-        PROP_CONTAINER_UPDATE_ID
+        PROP_CONTAINER_UPDATE_ID,
+        PROP_TOTAL_DELETED_CHILD_COUNT
 };
 
 static void
@@ -85,6 +86,12 @@ gupnp_didl_lite_container_get_property (GObject    *object,
                                gupnp_didl_lite_container_get_container_update_id
                                         (container));
                 break;
+        case PROP_TOTAL_DELETED_CHILD_COUNT:
+                g_value_set_uint
+                        (value,
+                         gupnp_didl_lite_container_get_total_deleted_child_count
+                                        (container));
+                break;
         default:
                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
                 break;
@@ -123,6 +130,11 @@ gupnp_didl_lite_container_set_property (GObject      *object,
                                         (container,
                                          g_value_get_uint (value));
                 break;
+        case PROP_TOTAL_DELETED_CHILD_COUNT:
+                gupnp_didl_lite_container_set_total_deleted_child_count
+                                        (container,
+                                         g_value_get_uint (value));
+                break;
         default:
                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
                 break;
@@ -213,6 +225,25 @@ gupnp_didl_lite_container_class_init (GUPnPDIDLLiteContainerClass *klass)
                                                  G_PARAM_STATIC_NAME |
                                                  G_PARAM_STATIC_NICK |
                                                  G_PARAM_STATIC_BLURB));
+
+        /**
+         * GUPnPDIDLLiteContainer:total-deleted-child-count:
+         *
+         * Total deleted child count of this container.
+         **/
+        g_object_class_install_property
+             (object_class,
+              PROP_TOTAL_DELETED_CHILD_COUNT,
+              g_param_spec_uint ("total-deleted-child-count",
+                                 "TotalDeletedChildCOunt",
+                                 "Total deleted child count of this container.",
+                                 0,
+                                 G_MAXUINT,
+                                 0,
+                                 G_PARAM_READWRITE |
+                                 G_PARAM_STATIC_NAME |
+                                 G_PARAM_STATIC_NICK |
+                                 G_PARAM_STATIC_BLURB));
 }
 
 /**
@@ -311,6 +342,55 @@ gupnp_didl_lite_container_container_update_id_is_set
 }
 
 /**
+ * gupnp_didl_lite_container_get_total_deleted_child_count:
+ * @container: #GUPnPDIDLLiteContainer
+ *
+ * Get the total deleted child count of the @container.
+ *
+ * Return value: The total deleted child count of the @container.
+ **/
+guint
+gupnp_didl_lite_container_get_total_deleted_child_count
+                                        (GUPnPDIDLLiteContainer *container)
+{
+        xmlNode *xml_node;
+
+        g_return_val_if_fail (container != NULL, 0);
+        g_return_val_if_fail (GUPNP_IS_DIDL_LITE_CONTAINER (container), 0);
+
+        xml_node = gupnp_didl_lite_object_get_xml_node
+                                (GUPNP_DIDL_LITE_OBJECT (container));
+
+        return xml_util_get_uint_child_element (xml_node,
+                                                "totalDeletedChildCount",
+                                                0);
+}
+
+/**
+ * gupnp_didl_lite_container_total_deleted_child_count_is_set:
+ * @container: #GUPnPDIDLLiteContainer
+ *
+ * Get whether the total deleted child conut of the @container is set.
+ *
+ * Return value: %TRUE if property is set, otherwise %FALSE
+ **/
+gboolean
+gupnp_didl_lite_container_total_deleted_child_count_is_set
+                                        (GUPnPDIDLLiteContainer *container)
+{
+        const char *content;
+        xmlNode *xml_node;
+
+        g_return_val_if_fail (container != NULL, FALSE);
+        g_return_val_if_fail (GUPNP_IS_DIDL_LITE_CONTAINER (container), FALSE);
+
+        xml_node = gupnp_didl_lite_object_get_xml_node
+                                        (GUPNP_DIDL_LITE_OBJECT (container));
+        content = xml_util_get_child_element_content (xml_node,
+                                                      "totalDeletedChildCount");
+        return content != NULL;
+}
+/**
  * gupnp_didl_lite_container_get_create_classes:
  * @container: #GUPnPDIDLLiteContainer
  *
@@ -547,6 +627,65 @@ gupnp_didl_lite_container_unset_container_update_id
 }
 
 /**
+ * gupnp_didl_lite_container_set_total_deleted_child_count:
+ * @container: #GUPnPDIDLLiteContainer
+ * @count: The container update ID
+ *
+ * Set the container update ID of the @container.
+ **/
+void
+gupnp_didl_lite_container_set_total_deleted_child_count
+                                        (GUPnPDIDLLiteContainer *container,
+                                         guint                   count)
+{
+        xmlNode *xml_node;
+        xmlNsPtr upnp_ns;
+        GUPnPXMLDoc *xml_doc;
+        char *str;
+        GUPnPDIDLLiteObject *self_as_object;
+
+        g_return_if_fail (container != NULL);
+        g_return_if_fail (GUPNP_IS_DIDL_LITE_CONTAINER (container));
+
+        self_as_object = GUPNP_DIDL_LITE_OBJECT (container);
+        xml_node = gupnp_didl_lite_object_get_xml_node (self_as_object);
+        xml_doc = gupnp_didl_lite_object_get_gupnp_xml_doc (self_as_object);
+        upnp_ns = gupnp_didl_lite_object_get_upnp_namespace (self_as_object);
+
+        str = g_strdup_printf ("%u", count);
+        xml_util_set_child (xml_node,
+                            upnp_ns,
+                            xml_doc->doc,
+                            "totalDeletedChildCount",
+                            str);
+        g_free (str);
+
+        g_object_notify (G_OBJECT (container), "total-deleted-child-count");
+}
+
+/**
+ * gupnp_didl_lite_container_unset_total_deleted_child_count:
+ * @container: #GUPnPDIDLLiteContainer
+ *
+ * Unset the total deleted child count property of the @container.
+ **/
+void
+gupnp_didl_lite_container_unset_total_deleted_child_count
+                                        (GUPnPDIDLLiteContainer *container)
+{
+        xmlNode *xml_node;
+
+        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
+                                        (GUPNP_DIDL_LITE_OBJECT (container));
+        xml_util_unset_child (xml_node, "totalDeletedChildCount");
+
+        g_object_notify (G_OBJECT (container), "total-deleted-child-count");
+}
+
+/**
  * gupnp_didl_lite_container_add_create_class:
  * @container: #GUPnPDIDLLiteContainer
  * @create_class: The createClass to add.
diff --git a/libgupnp-av/gupnp-didl-lite-container.h b/libgupnp-av/gupnp-didl-lite-container.h
index 4b85fca..b9a28fa 100644
--- a/libgupnp-av/gupnp-didl-lite-container.h
+++ b/libgupnp-av/gupnp-didl-lite-container.h
@@ -84,6 +84,14 @@ gboolean
 gupnp_didl_lite_container_container_update_id_is_set
                                         (GUPnPDIDLLiteContainer *container);
 
+guint
+gupnp_didl_lite_container_get_total_deleted_child_count
+                                        (GUPnPDIDLLiteContainer *container);
+
+gboolean
+gupnp_didl_lite_container_total_deleted_child_count_is_set
+                                        (GUPnPDIDLLiteContainer *container);
+
 GList *
 gupnp_didl_lite_container_get_create_classes
                                         (GUPnPDIDLLiteContainer *container);
@@ -112,6 +120,15 @@ gupnp_didl_lite_container_unset_container_update_id
                                         (GUPnPDIDLLiteContainer *container);
 
 void
+gupnp_didl_lite_container_set_total_deleted_child_count
+                                        (GUPnPDIDLLiteContainer *container,
+                                         guint                   count);
+
+void
+gupnp_didl_lite_container_unset_total_deleted_child_count
+                                        (GUPnPDIDLLiteContainer *container);
+
+void
 gupnp_didl_lite_container_add_create_class
                                         (GUPnPDIDLLiteContainer *container,
                                          const char             *create_class);



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