X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=libspi%2Flistener.c;h=9c2547cd1462d6156213d41dca5cce33b6cb067a;hb=68b558bcef701bc71b1b7e53f68935f9c632fcdb;hp=785eaa92bfcf3102ab4dacb40a89a03624d41be7;hpb=9bf98cd378e1572019a743bb4bf18e896b4fcd1d;p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git diff --git a/libspi/listener.c b/libspi/listener.c index 785eaa9..9c2547c 100644 --- a/libspi/listener.c +++ b/libspi/listener.c @@ -1,41 +1,52 @@ /* - * listener.c: test for accessibility implementation + * AT-SPI - Assistive Technology Service Provider Interface + * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) * + * Copyright 2001 Sun Microsystems Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. */ -#define DEBUG_PRINTSTUFF -#ifdef DEBUG_PRINTSTUFF + +/* listener.c: implements the Listener interface */ + +#ifdef SPI_DEBUG #include #endif -#include -#include -#include -/* - * This pulls the definition for the BonoboObject (GType) - */ -#include "listener.h" +#include +#include -/* - * Our parent Gtk object type - */ -#define PARENT_TYPE BONOBO_X_OBJECT_TYPE +/* Our parent Gtk object type */ +#define PARENT_TYPE BONOBO_TYPE_OBJECT -/* - * A pointer to our parent object class - */ -static GObjectClass *listener_parent_class; +/* A pointer to our parent object class */ +static GObjectClass *spi_listener_parent_class; /* * Implemented GObject::finalize */ static void -listener_object_finalize (GObject *object) +spi_listener_object_finalize (GObject *object) { -/* Listener *listener = LISTENER (object); */ +/* SpiListener *listener = SPI_LISTENER (object); */ - printf("listener_object_finalize called\n"); - - listener_parent_class->finalize (object); +#ifdef SPI_DEBUG + fprintf(stderr, "spi_listener_object_finalize called\n"); +#endif + spi_listener_parent_class->finalize (object); } /* @@ -47,68 +58,55 @@ impl_notify_event (PortableServer_Servant servant, const Accessibility_Event *e, CORBA_Environment *ev) { - fprintf (stderr, "notify...\n"); +#ifdef SPI_DEBUG + fprintf (stderr, "notify %s...\n", e->type); fprintf (stderr, "source name: '%s'\n", - Accessibility_Accessible__get_name(e->target, ev)); + 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); + } + /* + fprintf (stderr, "source is component ? : %s\n", + Accessibility_Accessible_queryInterface (e->source, + "IDL:Accessibility/Component:1.0", + ev) + ? "yes" : "no"); + */ +#endif + if (e->source != CORBA_OBJECT_NIL) + { + Accessibility_Accessible_unref (e->source, ev); + } } static void -listener_class_init (ListenerClass *klass) +spi_listener_class_init (SpiListenerClass *klass) { GObjectClass * object_class = (GObjectClass *) klass; POA_Accessibility_EventListener__epv *epv = &klass->epv; - listener_parent_class = g_type_class_ref (BONOBO_X_OBJECT_TYPE); + spi_listener_parent_class = g_type_class_peek_parent (klass); - object_class->finalize = listener_object_finalize; + object_class->finalize = spi_listener_object_finalize; epv->notifyEvent = impl_notify_event; } static void -listener_init (Listener *listener) +spi_listener_init (SpiListener *listener) { } -GType -listener_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo tinfo = { - sizeof (ListenerClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) listener_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class data */ - sizeof (Listener), - 0, /* n preallocs */ - (GInstanceInitFunc) listener_init, - NULL /* value table */ - }; - /* - * Here we use bonobo_x_type_unique instead of - * gtk_type_unique, this auto-generates a load of - * CORBA structures for us. All derived types must - * use bonobo_x_type_unique. - */ - type = bonobo_x_type_unique ( - PARENT_TYPE, - POA_Accessibility_EventListener__init, - NULL, - G_STRUCT_OFFSET (ListenerClass, epv), - &tinfo, - "Listener"); - } - - return type; -} +BONOBO_TYPE_FUNC_FULL (SpiListener, + Accessibility_EventListener, + PARENT_TYPE, + spi_listener); -Listener * -listener_new (void) +SpiListener * +spi_listener_new (void) { - Listener *retval = - LISTENER (g_object_new (listener_get_type (), NULL)); + SpiListener *retval = g_object_new (SPI_LISTENER_TYPE, NULL); return retval; }