- registry->desktop->applications = g_list_delete_link (registry->desktop->applications, list);
-#ifdef SPI_DEBUG
- fprintf (stderr, "there are now %d apps registered.\n", g_list_length (registry->desktop->applications));
- for (i = 0; i < g_list_length (registry->desktop->applications); ++i) {
- fprintf (stderr, "getting application %d\n", i);
- fprintf (stderr, "object address %p\n",
- g_list_nth_data (registry->desktop->applications, i));
- }
-#endif
- }
- else
- fprintf (stderr, "could not deregister application\n");
-}
-
-/*
- * CORBA Accessibility::Registry::registerGlobalEventListener method implementation
- */
-static void
-impl_accessibility_registry_register_global_event_listener (
- PortableServer_Servant servant,
- Accessibility_EventListener listener,
- const CORBA_char *event_name,
- CORBA_Environment *ev)
-{
- Registry *registry = REGISTRY (bonobo_object_from_servant (servant));
- ListenerStruct *ls = g_malloc (sizeof (ListenerStruct));
- EventTypeStruct etype;
- gboolean is_toolkit_specific = TRUE;
-
- fprintf(stderr, "registering for events of type %s\n", event_name);
-
- /* parse, check major event type and add listener accordingly */
- parse_event_type (&etype, event_name);
- ls->event_type_hash = etype.hash;
- ls->event_type_cat = etype.type_cat;
-
- switch (etype.type_cat)
- {
- case (ETYPE_FOCUS) :
- case (ETYPE_OBJECT) :
- case (ETYPE_PROPERTY) :
- ls->listener = CORBA_Object_duplicate (listener, ev);
- registry->object_listeners =
- g_list_append (registry->object_listeners, ls);
- break;
- case (ETYPE_WINDOW) :
- /* Support for Window Manager Events is not yet implemented */
- break;
- case (ETYPE_TOOLKIT) :
- ls->listener = CORBA_Object_duplicate (listener, ev);
- registry->toolkit_listeners =
- g_list_append (registry->toolkit_listeners, ls);
- register_with_toolkits (registry, &etype, ev);
- break;
- default:
- break;
- }
-}
-
-/*
- * CORBA Accessibility::Registry::deregisterGlobalEventListenerAll method implementation
- */
-static void
-impl_accessibility_registry_deregister_global_event_listener_all (
- PortableServer_Servant servant,
- Accessibility_EventListener listener,
- CORBA_Environment *ev)
-{
- Registry *registry = REGISTRY (bonobo_object_from_servant (servant));
- ListenerStruct *ls = g_malloc (sizeof (ListenerStruct));
- GList *list;
- ls->listener = listener;
- list = g_list_find_custom (registry->object_listeners, ls,
- compare_listener_corbaref);
-
- /*
- * TODO : de-register with toolkit if the last instance of a listener
- * to a particular toolkit event type has been deregistered.
- */
-
- while (list)
- {
- fprintf (stderr, "deregistering listener\n");
- registry->object_listeners = g_list_delete_link (registry->object_listeners, list);
- list = g_list_find_custom (registry->object_listeners, ls, compare_listener_corbaref);
- }
- list = g_list_find_custom (registry->toolkit_listeners, ls, compare_listener_corbaref);
- while (list)
- {
- fprintf (stderr, "deregistering listener\n");
- registry->toolkit_listeners = g_list_delete_link (registry->toolkit_listeners, list);
- list = g_list_find_custom (registry->toolkit_listeners, ls, compare_listener_corbaref);
- }
-}
-
-/*
- * CORBA Accessibility::Registry::deregisterGlobalEventListener method implementation
- */
-static void
-impl_accessibility_registry_deregister_global_event_listener (
- PortableServer_Servant servant,
- Accessibility_EventListener listener,
- const CORBA_char * event_name,
- CORBA_Environment *ev)
-{
- Registry *registry = REGISTRY (bonobo_object_from_servant (servant));
- ListenerStruct ls;
- EventTypeStruct etype;
- GList *list;
- GList **listeners;
-
- parse_event_type (&etype, event_name);
- switch (etype.type_cat)
- {
- case (ETYPE_OBJECT) :
- case (ETYPE_PROPERTY) :
- case (ETYPE_FOCUS) :
- listeners = ®istry->object_listeners;
- break;
- case (ETYPE_WINDOW) :
- /* Support for Window Manager Events is not yet implemented */
- break;
- case (ETYPE_TOOLKIT) :
- listeners = ®istry->toolkit_listeners;
- break;
- default:
- break;
- }
-
- ls.event_type_hash = etype.hash;
- list = g_list_find_custom (*listeners, &ls, compare_listener_hash);
-
- while (list)
- {
- fprintf (stderr, "deregistering listener\n");
- *listeners = g_list_delete_link (*listeners, list);
- list = g_list_find_custom (*listeners, &ls, compare_listener_hash);
- }