X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=libspi%2Flistener.c;h=9c2547cd1462d6156213d41dca5cce33b6cb067a;hb=af73589b8f6efcd457290b11e183769918cf3294;hp=0d5c4a09fdcc68024b1ee38c03b8c39ced8c39e4;hpb=408978dd34f3338e49b6ace5f60b7606579ce7a9;p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git diff --git a/libspi/listener.c b/libspi/listener.c index 0d5c4a0..9c2547c 100644 --- a/libspi/listener.c +++ b/libspi/listener.c @@ -20,32 +20,19 @@ * Boston, MA 02111-1307, USA. */ -/* - * listener.c: test for accessibility implementation - * - */ +/* listener.c: implements the Listener interface */ #ifdef SPI_DEBUG #include #endif #include -#include -#include +#include -/* - * 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; /* @@ -63,7 +50,7 @@ spi_listener_object_finalize (GObject *object) } /* - * CORBA Accessibility::SpiListener::notifyEvent method implementation + * CORBA Accessibility::Listener::notifyEvent method implementation */ static void @@ -74,7 +61,7 @@ impl_notify_event (PortableServer_Servant servant, #ifdef SPI_DEBUG fprintf (stderr, "notify %s...\n", e->type); fprintf (stderr, "source name: '%s'\n", - Accessibility_SpiAccessible__get_name(e->source, 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"), @@ -83,13 +70,16 @@ impl_notify_event (PortableServer_Servant servant, } /* fprintf (stderr, "source is component ? : %s\n", - Accessibility_SpiAccessible_queryInterface (e->source, - "IDL:Accessibility/SpiComponent:1.0", + Accessibility_Accessible_queryInterface (e->source, + "IDL:Accessibility/Component:1.0", ev) ? "yes" : "no"); */ #endif - Accessibility_SpiAccessible_unref (e->source, ev); + if (e->source != CORBA_OBJECT_NIL) + { + Accessibility_Accessible_unref (e->source, ev); + } } static void @@ -97,7 +87,7 @@ spi_listener_class_init (SpiListenerClass *klass) { 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; @@ -109,46 +99,14 @@ spi_listener_init (SpiListener *listener) { } -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; }