* AT-SPI - Assistive Technology Service Provider Interface
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
*
- * Copyright 2001 Sun Microsystems Inc.
+ * Copyright 2001, 2002 Sun Microsystems Inc.,
+ * Copyright 2001, 2002 Ximian, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* Boston, MA 02111-1307, USA.
*/
-/*
- * listener.c: test for accessibility implementation
- *
- */
+/* listener.c: implements the Listener interface */
#ifdef SPI_DEBUG
#include <stdio.h>
#endif
#include <config.h>
-#include <bonobo/Bonobo.h>
-#include <libspi/Accessibility.h>
+#include <libspi/listener.h>
-/*
- * This pulls the definition for the BonoboObject (GType)
- */
-#include "listener.h"
-
-/*
- * Our parent Gtk object type
- */
-#define PARENT_TYPE BONOBO_OBJECT_TYPE
+/* Our parent Gtk object type */
+#define PARENT_TYPE BONOBO_TYPE_OBJECT
-/*
- * A pointer to our parent object class
- */
+/* A pointer to our parent object class */
static GObjectClass *spi_listener_parent_class;
/*
fprintf (stderr, "source name: '%s'\n",
Accessibility_Accessible__get_name(e->source, ev));
if (ev->_major != CORBA_NO_EXCEPTION) {
- fprintf(stderr,
- ("Accessibility app error: exception during event notification: %s\n"),
- CORBA_exception_id(ev));
- exit(-1);
+ DBG (2, g_warning ("Accessibility app error: exception during event notification: %s\n"),
+ CORBA_exception_id(ev)));
}
/*
fprintf (stderr, "source is component ? : %s\n",
? "yes" : "no");
*/
#endif
- Accessibility_Accessible_unref (e->source, ev);
+ if (e->source != CORBA_OBJECT_NIL)
+ {
+ Accessibility_Accessible_unref (e->source, ev);
+ }
}
static void
{
GObjectClass * object_class = (GObjectClass *) klass;
POA_Accessibility_EventListener__epv *epv = &klass->epv;
- spi_listener_parent_class = g_type_class_ref (BONOBO_OBJECT_TYPE);
+ spi_listener_parent_class = g_type_class_peek_parent (klass);
object_class->finalize = spi_listener_object_finalize;
{
}
-GType
-spi_listener_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo tinfo = {
- sizeof (SpiListenerClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) spi_listener_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class data */
- sizeof (SpiListener),
- 0, /* n preallocs */
- (GInstanceInitFunc) spi_listener_init,
- NULL /* value table */
- };
- /*
- * Here we use bonobo_type_unique instead of
- * gtk_type_unique, this auto-generates a load of
- * CORBA structures for us. All derived types must
- * use bonobo_type_unique.
- */
- type = bonobo_type_unique (
- PARENT_TYPE,
- POA_Accessibility_EventListener__init,
- NULL,
- G_STRUCT_OFFSET (SpiListenerClass, epv),
- &tinfo,
- "SpiListener");
- }
-
- return type;
-}
+BONOBO_TYPE_FUNC_FULL (SpiListener,
+ Accessibility_EventListener,
+ PARENT_TYPE,
+ spi_listener)
SpiListener *
spi_listener_new (void)
{
- SpiListener *retval =
- SPI_LISTENER (g_object_new (spi_listener_get_type (), NULL));
+ SpiListener *retval = g_object_new (SPI_LISTENER_TYPE, NULL);
return retval;
}