Revved to 1.10.3, to fix previous bad dist due to libtool bug.
[atk.git] / atk / atkstreamablecontent.c
blob6b56456c85f04a76e015eaf08ccdcbdaea5c3f90
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"
22 GType
23 atk_streamable_content_get_type (void)
25 static GType type = 0;
27 if (!type) {
28 GTypeInfo tinfo =
30 sizeof (AtkStreamableContentIface),
31 (GBaseInitFunc) NULL,
32 (GBaseFinalizeFunc) NULL,
36 type = g_type_register_static (G_TYPE_INTERFACE, "AtkStreamableContent", &tinfo, 0);
39 return type;
42 /**
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.
49 **/
50 gint
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);
61 else
62 return 0;
65 /**
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.
75 **/
76 G_CONST_RETURN gchar*
77 atk_streamable_content_get_mime_type (AtkStreamableContent *streamable,
78 gint i)
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);
89 else
90 return NULL;
93 /**
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
101 * type.
103 GIOChannel*
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);
116 else
117 return NULL;