+impl_accessibility_application_register_object_event_listener (PortableServer_Servant servant,
+ Accessibility_EventListener listener,
+ const CORBA_char *event_name,
+ CORBA_Environment *ev)
+{
+ guint spi_listener_id = 0;
+ const char *toolkit_specific_event_name =
+ lookup_toolkit_event_for_name (event_name);
+ if (toolkit_specific_event_name)
+ {
+ spi_listener_id =
+ atk_add_global_event_listener (spi_application_object_event_listener,
+ toolkit_specific_event_name);
+ the_app->toolkit_listeners = g_list_append (the_app->toolkit_listeners,
+ CORBA_Object_duplicate (listener, ev));
+ }
+#ifdef SPI_DEBUG
+ fprintf (stderr, "registered %d for object events named: %s\n",
+ spi_listener_id,
+ event_name);
+#endif
+}
+
+static void
+notify_listeners (GList *listeners, SpiAccessible *source, Accessibility_Event *e)
+{
+ GList *l;
+ CORBA_Environment ev;
+
+ CORBA_exception_init (&ev);
+
+ for (l = listeners; l; l = l->next)
+ {
+ Accessibility_EventListener listener = l->data;
+
+ e->source = bonobo_object_dup_ref (BONOBO_OBJREF (source), &ev);
+
+ Accessibility_EventListener_notifyEvent (listener, e, &ev);
+ /*
+ * when this (oneway) call completes, the CORBA refcount and
+ * Bonobo_Unknown refcount will be decremented by the recipient
+ */
+ CORBA_exception_free (&ev);
+ }
+}
+
+static const char *
+reverse_lookup_name_for_toolkit_event (char *toolkit_specific_name)
+{
+ const char *generic_name;
+ SpiApplicationClass *klass = g_type_class_peek (SPI_APPLICATION_TYPE);
+#ifdef SPI_DEBUG
+ fprintf (stderr, "(reverse lookup) looking for %s in hash table.\n", toolkit_specific_name);
+#endif
+ generic_name =
+ (const char *) g_hash_table_lookup (klass->generic_event_names, toolkit_specific_name);
+#ifdef SPI_DEBUG
+ fprintf (stderr, "toolkit event %s converted to %s\n", toolkit_specific_name, generic_name);
+#endif
+ return generic_name;
+}
+
+static void
+init_toolkit_names (GHashTable **generic_event_names, GHashTable **toolkit_event_names)
+{
+ *toolkit_event_names = g_hash_table_new (g_str_hash, g_str_equal);
+ *generic_event_names = g_hash_table_new (g_str_hash, g_str_equal);
+ g_hash_table_insert (*toolkit_event_names,
+ "object:property-change",
+ "Gtk:AtkObject:property-change");
+ g_hash_table_insert (*generic_event_names,
+ "Gtk:AtkObject:property-change",
+ "object:property-change");
+#ifdef SPI_DEBUG
+ fprintf (stderr, "inserted spi_selection_changed hash\n");
+#endif
+}
+
+static void
+spi_application_class_init (SpiApplicationClass *klass)