1 /* ATK - Accessibility Toolkit
2 * Copyright 2001 Sun Microsystems Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #include "atkstreamablecontent.h"
23 atk_streamable_content_get_type (void)
25 static GType type = 0;
30 sizeof (AtkStreamableContentIface),
32 (GBaseFinalizeFunc) NULL,
36 type = g_type_register_static (G_TYPE_INTERFACE, "AtkStreamableContent", &tinfo, 0);
43 * atk_streamable_content_get_n_mime_types:
44 * @streamable: a GObject instance that implements AtkStreamableContentIface
46 * Gets the number of mime types supported by this object.
48 * Returns: a gint which is the number of mime types supported by the object.
51 atk_streamable_content_get_n_mime_types (AtkStreamableContent *streamable)
53 AtkStreamableContentIface *iface;
55 g_return_val_if_fail (ATK_IS_STREAMABLE_CONTENT (streamable), 0);
57 iface = ATK_STREAMABLE_CONTENT_GET_IFACE (streamable);
59 if (iface->get_n_mime_types)
60 return (iface->get_n_mime_types) (streamable);
66 * atk_streamable_content_get_mime_type:
67 * @streamable: a GObject instance that implements AtkStreamableContent
68 * @i: a gint representing the position of the mime type starting from 0
70 * Gets the character string of the specified mime type. The first mime
71 * type is at position 0, the second at position 1, and so on.
73 * Returns : a gchar* representing the specified mime type; the caller
74 * should not free the character string.
77 atk_streamable_content_get_mime_type (AtkStreamableContent *streamable,
80 AtkStreamableContentIface *iface;
82 g_return_val_if_fail (i >= 0, NULL);
83 g_return_val_if_fail (ATK_IS_STREAMABLE_CONTENT (streamable), NULL);
85 iface = ATK_STREAMABLE_CONTENT_GET_IFACE (streamable);
87 if (iface->get_mime_type)
88 return (iface->get_mime_type) (streamable, i);
94 * atk_streamable_content_get_stream:
95 * @streamable: a GObject instance that implements AtkStreamableContentIface
96 * @mime_type: a gchar* representing the mime type
98 * Gets the content in the specified mime type.
100 * Returns: A #GIOChannel which contains the content in the specified mime
104 atk_streamable_content_get_stream (AtkStreamableContent *streamable,
105 const gchar *mime_type)
107 AtkStreamableContentIface *iface;
109 g_return_val_if_fail (mime_type != NULL, NULL);
110 g_return_val_if_fail (ATK_IS_STREAMABLE_CONTENT (streamable), NULL);
112 iface = ATK_STREAMABLE_CONTENT_GET_IFACE (streamable);
114 if (iface->get_stream)
115 return (iface->get_stream) (streamable, mime_type);
121 * atk_streamable_content_get_uri:
122 * @streamable: a GObject instance that implements AtkStreamableContentIface
123 * @mime_type: a gchar* representing the mime type, or NULL to request a URI
124 * for the default mime type.
126 * Get a string representing a URI in IETF standard format
127 * (see http://www.ietf.org/rfc/rfc2396.txt) from which the object's content
128 * may be streamed in the specified mime-type, if one is available.
129 * If mime_type is NULL, the URI for the default (and possibly only) mime-type is
132 * Note that it is possible for get_uri to return NULL but for
133 * get_stream to work nonetheless, since not all GIOChannels connect to URIs.
135 * Returns: Returns a string representing a URI, or NULL if no corresponding URI
136 * can be constructed.
139 atk_streamable_content_get_uri (AtkStreamableContent *streamable,
140 const gchar *mime_type)
142 AtkStreamableContentIface *iface;
144 g_return_val_if_fail (mime_type != NULL, NULL);
145 g_return_val_if_fail (ATK_IS_STREAMABLE_CONTENT (streamable), NULL);
147 iface = ATK_STREAMABLE_CONTENT_GET_IFACE (streamable);
150 return (iface->get_uri) (streamable, mime_type);