Cleaned up some suspect int* casts, and added assertions to text calls in libspi
[platform/core/uifw/at-spi2-atk.git] / libspi / listener.c
index d700aeb..158bbc4 100644 (file)
@@ -31,7 +31,7 @@
 
 #include <config.h>
 #include <bonobo/Bonobo.h>
-#include <Accessible.h>
+#include <libspi/Accessibility.h>
 
 /*
  * This pulls the definition for the BonoboObject (GType)
@@ -41,7 +41,7 @@
 /*
  * Our parent Gtk object type
  */
-#define PARENT_TYPE BONOBO_X_OBJECT_TYPE
+#define PARENT_TYPE BONOBO_OBJECT_TYPE
 
 /*
  * A pointer to our parent object class
@@ -72,10 +72,24 @@ impl_notify_event (PortableServer_Servant     servant,
                    CORBA_Environment         *ev)
 {
 #ifdef SPI_DEBUG
-  fprintf (stderr, "notify...\n");
+  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
+  Accessibility_Accessible_unref (e->source, ev);
 }
 
 static void
@@ -83,7 +97,7 @@ listener_class_init (ListenerClass *klass)
 {
         GObjectClass * object_class = (GObjectClass *) klass;
         POA_Accessibility_EventListener__epv *epv = &klass->epv;
-        listener_parent_class = g_type_class_ref (BONOBO_X_OBJECT_TYPE);
+        listener_parent_class = g_type_class_ref (BONOBO_OBJECT_TYPE);
 
         object_class->finalize = listener_object_finalize;
 
@@ -114,12 +128,12 @@ listener_get_type (void)
                         NULL /* value table */
                 };
                 /*
-                 *   Here we use bonobo_x_type_unique instead of
+                 *   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_x_type_unique.
+                 * use bonobo_type_unique.
                  */
-                type = bonobo_x_type_unique (
+                type = bonobo_type_unique (
                         PARENT_TYPE,
                         POA_Accessibility_EventListener__init,
                         NULL,