2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2001, 2002 Sun Microsystems Inc.,
6 * Copyright 2001, 2002 Ximian, Inc.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
24 /* streamablecontent.c : implements the StreamableContent interface */
28 #include <libspi/accessible.h>
29 #include <libspi/component.h>
30 #include <libspi/streamablecontent.h>
32 /* Our parent Gtk object type */
33 #define PARENT_TYPE SPI_TYPE_BASE
35 /* A pointer to our parent object class */
36 static GObjectClass *spi_streamable_parent_class;
38 static AtkStreamableContent *
39 get_streamable_from_servant (PortableServer_Servant servant)
41 SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant));
42 g_return_val_if_fail (object != NULL, NULL);
43 g_return_val_if_fail (ATK_IS_STREAMABLE_CONTENT(object->gobj), NULL);
44 return ATK_STREAMABLE_CONTENT (object->gobj);
48 * CORBA Accessibility::StreamableContent::getContentTypes method implementation
50 static Accessibility_StringSeq*
51 impl_accessibility_streamable_get_content_types (PortableServer_Servant servant,
52 CORBA_Environment *ev)
54 Accessibility_StringSeq *typelist = Accessibility_StringSeq__alloc ();
55 AtkStreamableContent *streamable = get_streamable_from_servant (servant);
58 typelist->_length = 0;
59 g_return_val_if_fail (streamable != NULL, typelist);
61 n_types = atk_streamable_content_get_n_mime_types (streamable);
62 typelist->_length = n_types;
63 typelist->_buffer = Accessibility_StringSeq_allocbuf (n_types);
64 for (i = 0; i < n_types; ++i) {
65 const gchar *mimetype = atk_streamable_content_get_mime_type (streamable, i);
66 typelist->_buffer[i] = CORBA_string_dup (mimetype ? mimetype : "");
73 * CORBA Accessibility::StreamableContent::getContent method implementation
76 impl_accessibility_streamable_get_content (PortableServer_Servant servant,
77 const CORBA_char * content_type,
78 CORBA_Environment *ev)
81 AtkStreamableContent *streamable = get_streamable_from_servant (servant);
84 g_return_val_if_fail (streamable != NULL, NULL);
86 gio = atk_streamable_content_get_stream (streamable, content_type);
88 stream = CORBA_OBJECT_NIL; /* FIXME! */
94 spi_streamable_class_init (SpiStreamableClass *klass)
96 POA_Accessibility_StreamableContent__epv *epv = &klass->epv;
97 spi_streamable_parent_class = g_type_class_peek_parent (klass);
99 epv->getContentTypes = impl_accessibility_streamable_get_content_types;
100 epv->getContent = impl_accessibility_streamable_get_content;
104 spi_streamable_init (SpiStreamable *streamable)
108 BONOBO_TYPE_FUNC_FULL (SpiStreamable,
109 Accessibility_StreamableContent,
114 spi_streamable_interface_new (AtkObject *o)
116 SpiStreamable *retval = g_object_new (SPI_STREAMABLE_TYPE, NULL);
118 spi_base_construct (SPI_BASE (retval), G_OBJECT(o));