2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2001 Sun Microsystems Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 /* accessibleeventlistener.c: implementation of SpiListener.idl */
29 #include <libspi/accessibleeventlistener.h>
31 /* Our parent Gtk object type */
32 #define PARENT_TYPE SPI_LISTENER_TYPE
34 /* A pointer to our parent object class */
35 static SpiListenerClass *spi_event_listener_parent_class;
38 * Implemented GObject::finalize
41 spi_event_listener_object_finalize (GObject *object)
44 fprintf(stderr, "spi_listener_object_finalize called\n");
46 ((GObjectClass *) spi_event_listener_parent_class)->finalize (object);
50 * CORBA Accessibility::Listener::notifyEvent method implementation
54 impl_accessible_event_notify_event (PortableServer_Servant servant,
55 const Accessibility_Event *e,
56 CORBA_Environment *ev)
60 VoidSpiEventListenerCB cb;
61 SpiEventListener *listener = SPI_ACCESSIBLE_EVENT_SPI_LISTENER (
62 bonobo_object_from_servant (servant));
63 len = g_list_length (listener->callbacks);
67 cb = (VoidSpiEventListenerCB) g_list_nth_data (listener->callbacks, n);
73 /* Accessibility_Accessible_unref (e->source, ev); */
77 spi_event_listener_class_init (SpiEventListenerClass *klass)
79 GObjectClass * object_class = (GObjectClass *) klass;
80 SpiListenerClass * spi_listener_class = (SpiListenerClass *) klass;
81 POA_Accessibility_EventListener__epv *epv = &spi_listener_class->epv;
82 spi_event_listener_parent_class = g_type_class_ref (SPI_LISTENER_TYPE);
84 object_class->finalize = spi_event_listener_object_finalize;
86 epv->notifyEvent = impl_accessible_event_notify_event;
90 spi_event_listener_init (SpiEventListener *listener)
92 listener->callbacks = NULL;
95 BONOBO_TYPE_FUNC (SpiEventListener,
100 spi_event_listener_new ()
102 SpiEventListener *retval = g_object_new (
103 SPI_ACCESSIBLE_EVENT_SPI_LISTENER_TYPE, NULL);
108 spi_event_listener_add_callback (SpiEventListener *listener,
109 VoidSpiEventListenerCB callback)
111 listener->callbacks = g_list_append (listener->callbacks, callback);
115 spi_event_listener_remove_callback (SpiEventListener *listener,
116 VoidSpiEventListenerCB callback)
118 listener->callbacks = g_list_remove (listener->callbacks, callback);