2 * Copyright (C) 2009 Nokia Corporation.
4 * Authors: Zeeshan Ali (Khattak) <zeeshan.ali@nokia.com>
5 * <zeeshanak@gnome.org>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
24 * SECTION:gupnp-didl-lite-item
25 * @short_description: DIDL-Lite Item
27 * #GUPnPDIDLLiteItem respresents a DIDL-Lite item element.
32 #include "gupnp-didl-lite-item.h"
35 G_DEFINE_TYPE (GUPnPDIDLLiteItem,
37 GUPNP_TYPE_DIDL_LITE_OBJECT);
45 gupnp_didl_lite_item_init (GUPnPDIDLLiteItem *item)
47 /* Nothing to initialize, yay! */
51 gupnp_didl_lite_item_get_property (GObject *object,
56 GUPnPDIDLLiteItem *item;
58 item = GUPNP_DIDL_LITE_ITEM (object);
60 switch (property_id) {
64 gupnp_didl_lite_item_get_ref_id (item));
67 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
73 gupnp_didl_lite_item_set_property (GObject *object,
79 GUPnPDIDLLiteItem *item;
81 item = GUPNP_DIDL_LITE_ITEM (object);
83 switch (property_id) {
85 gupnp_didl_lite_item_set_ref_id (item,
86 g_value_get_string (value));
89 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
95 gupnp_didl_lite_item_class_init (GUPnPDIDLLiteItemClass *klass)
97 GObjectClass *object_class;
99 object_class = G_OBJECT_CLASS (klass);
101 object_class->get_property = gupnp_didl_lite_item_get_property;
102 object_class->set_property = gupnp_didl_lite_item_set_property;
105 * GUPnPDIDLLiteItem:ref-id:
107 * The ref ID of this item.
109 g_object_class_install_property
112 g_param_spec_string ("ref-id",
114 "The ref ID of this item.",
117 G_PARAM_STATIC_NAME |
118 G_PARAM_STATIC_NICK |
119 G_PARAM_STATIC_BLURB));
123 * gupnp_didl_lite_item_get_ref_id:
124 * @item: #GUPnPDIDLLiteItem
126 * Get the ref ID of the @item.
128 * Return value: The ref ID of the @item, or %NULL.
131 gupnp_didl_lite_item_get_ref_id (GUPnPDIDLLiteItem *item)
135 g_return_val_if_fail (item != NULL, 0);
136 g_return_val_if_fail (GUPNP_IS_DIDL_LITE_ITEM (item), NULL);
138 xml_node = gupnp_didl_lite_object_get_xml_node
139 (GUPNP_DIDL_LITE_OBJECT (item));
141 return xml_util_get_attribute_content (xml_node, "refID");
145 * gupnp_didl_lite_item_set_ref_id:
146 * @item: #GUPnPDIDLLiteItem
147 * @ref_id: The ref ID
149 * Set the ref ID of the @item.
152 gupnp_didl_lite_item_set_ref_id (GUPnPDIDLLiteItem *item,
157 g_return_if_fail (item != NULL);
158 g_return_if_fail (GUPNP_IS_DIDL_LITE_ITEM (item));
160 xml_node = gupnp_didl_lite_object_get_xml_node
161 (GUPNP_DIDL_LITE_OBJECT (item));
163 xmlSetProp (xml_node,
164 (unsigned char *) "refID",
165 (unsigned char *) ref_id);
167 g_object_notify (G_OBJECT (item), "ref-id");