-}
-
-static gint
-compare_object_hash (gconstpointer p1, gconstpointer p2)
-{
- CORBA_Environment ev;
- long long diff = ((CORBA_Object_hash ((CORBA_Object) p2, (CORBA_unsigned_long) 0, &ev)) -
- (CORBA_Object_hash ((CORBA_Object) p1, (CORBA_unsigned_long) 0, &ev)));
- return ((diff < 0) ? -1 : ((diff > 0) ? 1 : 0));
-}
-
-static void
-register_with_toolkits (Registry *registry_bonobo_object, EventTypeStruct *etype, CORBA_Environment *ev)
-{
- gint n_desktops;
- gint n_apps;
- gint i, j;
- Accessibility_Desktop desktop;
- Accessibility_Application app;
- Accessibility_Registry registry;
- registry = bonobo_object_corba_objref (bonobo_object (registry_bonobo_object));
-
- /* for each app in each desktop, call ...Application_registerToolkitEventListener */
-
- n_desktops = Accessibility_Registry_getDesktopCount (registry, ev);
-
- for (i=0; i<n_desktops; ++i)
- {
- desktop = Accessibility_Registry_getDesktop (registry, i, ev);
- n_apps = Accessibility_Desktop__get_childCount (desktop, ev);
- for (j=0; j<n_apps; ++j)
- {
- app = (Accessibility_Application) Accessibility_Desktop_getChildAtIndex (desktop,
- j,
- ev);
- /* TODO: should we be ref-ing the registry object before each call ? */
- Accessibility_Application_registerToolkitEventListener (app,
- registry,
- CORBA_string_dup (etype->event_name),
- ev);
- }
- }
-}
-
-static gint
-compare_listener_hash (gconstpointer p1, gconstpointer p2)
-{
- return (((ListenerStruct *)p2)->event_type_hash - ((ListenerStruct *)p1)->event_type_hash);
-}
-
-static void
-parse_event_type (EventTypeStruct *etype, char *event_name)
-{
- guint nbytes = 0;
- gchar **split_string;
-
- split_string = g_strsplit(event_name, ":", 4);
- etype->event_name = g_strndup(event_name, 255);
-
- if (!g_ascii_strncasecmp (event_name, "focus:", 6))
- {
- etype->type_cat = ETYPE_FOCUS;
- }
- else if (!g_ascii_strncasecmp (event_name, "window:", 7))
- {
- etype->type_cat = ETYPE_WINDOW;
- }
- else
- {
- etype->type_cat = ETYPE_TOOLKIT;
- }
-
- if (split_string[1])
- {
- etype->major = split_string[1];
- if (split_string[2])
- {
- etype->minor = split_string[2];
- if (split_string[3])
- {
- etype->detail = split_string[3];
- etype->hash = g_str_hash ( g_strconcat (split_string[1], split_string[2], split_string[3], NULL));
- }
- else
- {
- etype->detail = g_strdup ("");
- etype->hash = g_str_hash ( g_strconcat (split_string[1], split_string[2], NULL));
- }
- }
- else
- {
- etype->minor = g_strdup ("");
- etype->hash = g_str_hash ( split_string[1]);
- }
- }
- else
- {
- etype->major = g_strdup ("");
- etype->minor = g_strdup ("");
- etype->detail = g_strdup ("");
- etype->hash = g_str_hash ("");
- }
-
- /* TODO: don't forget to free the strings from caller when done ! */