+GType
+_atk_bridge_type_from_iface (const char *iface)
+{
+ if (!strcmp (iface, ATSPI_DBUS_INTERFACE_ACCESSIBLE))
+ return ATK_TYPE_OBJECT;
+ if (!strcmp (iface, ATSPI_DBUS_INTERFACE_ACTION))
+ return ATK_TYPE_ACTION;
+ if (!strcmp (iface, ATSPI_DBUS_INTERFACE_COMPONENT))
+ return ATK_TYPE_COMPONENT;
+ if (!strcmp (iface, ATSPI_DBUS_INTERFACE_DOCUMENT))
+ return ATK_TYPE_DOCUMENT;
+ if (!strcmp (iface, ATSPI_DBUS_INTERFACE_HYPERTEXT))
+ return ATK_TYPE_HYPERTEXT;
+ if (!strcmp (iface, ATSPI_DBUS_INTERFACE_HYPERLINK))
+ return ATK_TYPE_HYPERLINK;
+ if (!strcmp (iface, ATSPI_DBUS_INTERFACE_IMAGE))
+ return ATK_TYPE_IMAGE;
+ if (!strcmp (iface, ATSPI_DBUS_INTERFACE_SELECTION))
+ return ATK_TYPE_SELECTION;
+ if (!strcmp (iface, ATSPI_DBUS_INTERFACE_TABLE))
+ return ATK_TYPE_TABLE;
+ if (!strcmp (iface, ATSPI_DBUS_INTERFACE_TEXT))
+ return ATK_TYPE_TEXT;
+ if (!strcmp (iface, ATSPI_DBUS_INTERFACE_VALUE))
+ return ATK_TYPE_VALUE;
+ return 0;
+}
+
+DRoutePropertyFunction
+_atk_bridge_find_property_func (const char *property, GType *type)
+{
+ const char *iface;
+ const char *member;
+ DRouteProperty *dp;
+
+ if (!strncasecmp (property, "action.", 7))
+ {
+ iface = ATSPI_DBUS_INTERFACE_ACTION;
+ member = property + 7;
+ }
+ else if (!strncasecmp (property, "component.", 10))
+ {
+ iface = ATSPI_DBUS_INTERFACE_COMPONENT;
+ member = property + 10;
+ }
+ else if (!strncasecmp (property, "selection.", 10))
+ {
+ iface = ATSPI_DBUS_INTERFACE_SELECTION;
+ member = property + 10;
+ }
+ else if (!strncasecmp (property, "table.", 6))
+ {
+ iface = ATSPI_DBUS_INTERFACE_TABLE;
+ member = property + 6;
+ }
+ else if (!strncasecmp (property, "text.", 5))
+ {
+ iface = ATSPI_DBUS_INTERFACE_TEXT;
+ member = property + 5;
+ }
+ else if (!strncasecmp (property, "value.", 6))
+ {
+ iface = ATSPI_DBUS_INTERFACE_VALUE;
+ member = property + 6;
+ }
+ else
+ {
+ iface = ATSPI_DBUS_INTERFACE_ACCESSIBLE;
+ member = property;
+ }
+
+ *type = _atk_bridge_type_from_iface (iface);
+
+ dp = g_hash_table_lookup (spi_global_app_data->property_hash, iface);
+
+ if (!dp)
+ return NULL;
+
+ for (;dp->name; dp++)
+ {
+ if (!strcasecmp (dp->name, member))
+ {
+ return dp->get;
+ }
+ }
+ return NULL;
+}
+
+static void
+add_property_to_event (event_data *evdata, const char *property)
+{
+ AtspiPropertyDefinition *prop = g_new0 (AtspiPropertyDefinition, 1);
+ prop->func = _atk_bridge_find_property_func (property, &prop->type);
+ if (!prop->func)
+ {
+ g_warning ("atk-bridge: Request for unknown property '%s'", property);
+ g_free (prop);
+ return;
+ }
+
+ prop->name = g_strdup (property);
+ evdata->properties = g_slist_append (evdata->properties, prop);
+}
+
+static void
+add_event_from_iter (DBusMessageIter *iter)
+{
+ const char *bus_name, *event;
+ event_data *evdata;
+
+ dbus_message_iter_get_basic (iter, &bus_name);
+ dbus_message_iter_next (iter);
+ dbus_message_iter_get_basic (iter, &event);
+ dbus_message_iter_next (iter);
+ evdata = add_event (bus_name, event);
+ if (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_ARRAY)
+ {
+ DBusMessageIter iter_sub_array;
+ dbus_message_iter_recurse (iter, &iter_sub_array);
+ while (dbus_message_iter_get_arg_type (&iter_sub_array) != DBUS_TYPE_INVALID)
+ {
+ const char *property;
+ dbus_message_iter_get_basic (&iter_sub_array, &property);
+ add_property_to_event (evdata, property);
+ dbus_message_iter_next (&iter_sub_array);
+ }
+ }
+}
+