<serialNumber>0000001</serialNumber>
<UPC></UPC>
<presentationURL></presentationURL>
+<iconList>
+</iconList>
<serviceList>
</serviceList>
<dlna:X_DLNADOC>DMS-1.50</dlna:X_DLNADOC>
rygel-plugin-loader.c \
rygel-resource-info.h \
rygel-resource-info.c \
+ rygel-icon-info.h \
+ rygel-icon-info.c \
rygel-connection-manager.h \
rygel-connection-manager.c \
rygel-media-receiver-registrar.h \
rygel-plugin-loader.vala \
rygel-resource-info.h \
rygel-resource-info.c \
+ rygel-icon-info.h \
+ rygel-icon-info.c \
rygel-connection-manager.h \
rygel-connection-manager.c \
rygel-media-receiver-registrar.h \
rygel-connection-manager.vala \
rygel-media-receiver-registrar.vala \
rygel-resource-info.vala \
+ rygel-icon-info.vala \
rygel-plugin.vala \
rygel-media-object.vala \
rygel-media-container.vala \
--- /dev/null
+/*
+ * Copyright (C) 2008 Nokia Corporation, all rights reserved.
+ *
+ * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
+ * <zeeshan.ali@nokia.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ */
+
+using Rygel;
+
+/**
+ * Holds information about an icon.
+ */
+public class Rygel.IconInfo {
+ public string mimetype;
+ public uint width;
+ public uint height;
+ public uint depth;
+ public string path;
+
+ public IconInfo (string mimetype,
+ uint width,
+ uint height,
+ uint depth,
+ string path) {
+ this.mimetype = mimetype;
+ this.width = width;
+ this.height = height;
+ this.depth = depth;
+ this.path = path;
+ }
+}
+
plugin.name,
gconf_path);
+ /* Then list each icon */
+ this.add_icons_to_desc (device_element, plugin);
+
/* Then list each service */
this.add_services_to_desc (device_element, plugin);
}
url = plugin_name + "/" + resource_info.type.name () + "/Control";
service_node->new_child (null, "controlURL", url);
}
+
+ private void add_icons_to_desc (Xml.Node *device_element,
+ Plugin plugin) {
+ Xml.Node *icon_list_node = Utils.get_xml_element (device_element,
+ "iconList",
+ null);
+ if (icon_list_node == null) {
+ warning ("Element /root/device/iconList not found.");
+
+ return;
+ }
+
+ foreach (IconInfo icon_info in plugin.icon_infos) {
+ add_icon_to_desc (icon_list_node, icon_info, plugin);
+ }
+ }
+
+ private void add_icon_to_desc (Xml.Node *icon_list_node,
+ IconInfo icon_info,
+ Plugin plugin) {
+ // Create the service node
+ Xml.Node *icon_node = icon_list_node->new_child (null, "icon");
+
+ string width = icon_info.width.to_string ();
+ string height = icon_info.height.to_string ();
+ string depth = icon_info.depth.to_string ();
+
+ icon_node->new_child (null, "mimetype", icon_info.mimetype);
+ icon_node->new_child (null, "width", width);
+ icon_node->new_child (null, "height", height);
+ icon_node->new_child (null, "depth", depth);
+
+ // PLUGIN_NAME-WIDTHxHEIGHTxDEPTH.png
+ string url = plugin.name + "-" +
+ width + "x" + height + "x" + depth + ".png";
+
+ this.context.host_path (icon_info.path, "/" + url);
+ icon_node->new_child (null, "url", url);
+ }
}
public string name;
public ArrayList<ResourceInfo> resource_infos;
+ public ArrayList<IconInfo> icon_infos;
public Plugin (string name) {
this.name = name;
this.resource_infos = new ArrayList<ResourceInfo> ();
+ this.icon_infos = new ArrayList<IconInfo> ();
/* Register Rygel.ConnectionManager */
var resource_info = new ResourceInfo
this.register_resource_type (resource_info.upnp_type,
resource_info.type);
}
+
+ public void add_icon (IconInfo icon_info) {
+ this.icon_infos.add (icon_info);
+ }
}