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/streamablecontent.h>
31 /* Our parent Gtk object type */
32 #define PARENT_TYPE SPI_TYPE_BASE
34 /* A pointer to our parent object class */
35 static GObjectClass *spi_streamable_parent_class;
37 static AtkStreamableContent *
38 get_streamable_from_servant (PortableServer_Servant servant)
40 SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant));
41 g_return_val_if_fail (object != NULL, NULL);
42 g_return_val_if_fail (ATK_IS_STREAMABLE_CONTENT(object->gobj), NULL);
43 return ATK_STREAMABLE_CONTENT (object->gobj);
47 * CORBA Accessibility::StreamableContent::getContentTypes method implementation
49 static Accessibility_StringSeq*
50 impl_accessibility_streamable_get_content_types (PortableServer_Servant servant,
51 CORBA_Environment *ev)
53 Accessibility_StringSeq *typelist = Accessibility_StringSeq__alloc ();
54 AtkStreamableContent *streamable = get_streamable_from_servant (servant);
57 typelist->_length = 0;
58 g_return_val_if_fail (streamable != NULL, typelist);
60 n_types = atk_streamable_content_get_n_mime_types (streamable);
61 typelist->_length = n_types;
62 typelist->_buffer = Accessibility_StringSeq_allocbuf (n_types);
63 for (i = 0; i < n_types; ++i) {
64 const gchar *mimetype = atk_streamable_content_get_mime_type (streamable, i);
65 typelist->_buffer[i] = CORBA_string_dup (mimetype ? mimetype : "");
72 * CORBA Accessibility::StreamableContent::getContent method implementation
75 impl_accessibility_streamable_get_content (PortableServer_Servant servant,
76 const CORBA_char * content_type,
77 CORBA_Environment *ev)
80 AtkStreamableContent *streamable = get_streamable_from_servant (servant);
83 g_return_val_if_fail (streamable != NULL, NULL);
85 gio = atk_streamable_content_get_stream (streamable, content_type);
87 stream = CORBA_OBJECT_NIL; /* FIXME! */
93 spi_streamable_class_init (SpiStreamableClass *klass)
95 POA_Accessibility_StreamableContent__epv *epv = &klass->epv;
96 spi_streamable_parent_class = g_type_class_peek_parent (klass);
98 epv->getContentTypes = impl_accessibility_streamable_get_content_types;
99 epv->getContent = impl_accessibility_streamable_get_content;
103 spi_streamable_init (SpiStreamable *streamable)
107 BONOBO_TYPE_FUNC_FULL (SpiStreamable,
108 Accessibility_StreamableContent,
113 spi_streamable_interface_new (AtkObject *o)
115 SpiStreamable *retval = g_object_new (SPI_STREAMABLE_TYPE, NULL);
117 spi_base_construct (SPI_BASE (retval), G_OBJECT(o));