From d135882cc3d595c5fc2f467a0b243753b57d956a Mon Sep 17 00:00:00 2001 From: Mike Gorse Date: Thu, 12 Jun 2008 15:13:01 -0600 Subject: [PATCH] Revert "Have org.freedesktop.atspi.Tree use droute" This reverts commit c844663e2e13adff0e9a60fbab1c9d57307c2fbb. --- atk-adaptor/accessible.h | 1 - atk-adaptor/atk-dbus.c | 1 - atk-adaptor/bridge.c | 3 +- atk-adaptor/tree.c | 61 ++++++++++++++++++++++++++++++++++------ 4 files changed, 55 insertions(+), 11 deletions(-) diff --git a/atk-adaptor/accessible.h b/atk-adaptor/accessible.h index d143ebd9..dbcaf2a6 100644 --- a/atk-adaptor/accessible.h +++ b/atk-adaptor/accessible.h @@ -45,7 +45,6 @@ void spi_initialize_hypertext(DRouteData *data); void spi_initialize_image(DRouteData *data); void spi_initialize_selection(DRouteData *data); void spi_initialize_table(DRouteData *data); -void spi_initialize_tree(DRouteData *data); void spi_initialize_text(DRouteData *data); void spi_initialize_value(DRouteData *data); void spi_initialize_introspectable(DRouteData *data, DRouteGetDatumFunction verify_object); diff --git a/atk-adaptor/atk-dbus.c b/atk-adaptor/atk-dbus.c index 14921dd1..93605c1d 100644 --- a/atk-adaptor/atk-dbus.c +++ b/atk-adaptor/atk-dbus.c @@ -142,7 +142,6 @@ spi_dbus_initialize (DRouteData * data) spi_initialize_image (data); spi_initialize_selection (data); spi_initialize_table (data); - spi_initialize_tree (data); spi_initialize_text (data); spi_initialize_value (data); spi_initialize_introspectable(data, (DRouteGetDatumFunction) spi_dbus_get_object); diff --git a/atk-adaptor/bridge.c b/atk-adaptor/bridge.c index ff051408..1374b99e 100644 --- a/atk-adaptor/bridge.c +++ b/atk-adaptor/bridge.c @@ -197,7 +197,8 @@ spi_app_init (AtkObject *root) //dbus_connection_set_exit_on_disconnect(ad->droute.bus, FALSE); dbus_bus_register(ad->droute.bus, &error); spi_dbus_initialize (&ad->droute); - if (!dbus_connection_try_register_fallback (ad->droute.bus, "/org/freedesktop/atspi", &droute_vtable, &ad->droute, &error)) + spi_register_tree_object(ad->droute.bus, &ad->droute, "/org/freedesktop/atspi/tree"); + if (!dbus_connection_try_register_fallback (ad->droute.bus, "/org/freedesktop/atspi/accessible", &droute_vtable, &ad->droute, &error)) { g_warning("Couldn't register droute.\n"); } diff --git a/atk-adaptor/tree.c b/atk-adaptor/tree.c index d52b5197..5c127471 100644 --- a/atk-adaptor/tree.c +++ b/atk-adaptor/tree.c @@ -197,18 +197,63 @@ impl_introspect (DBusConnection *bus, DBusMessage *message, void *user_data) return reply; } -static DRouteMethod methods[] = { - {impl_getRoot, "getRoot"}, - {impl_getTree, "getTree", TRUE}, - {NULL, NULL} +static DBusHandlerResult +message_handler (DBusConnection *bus, DBusMessage *message, void *user_data) +{ + const char *iface = dbus_message_get_interface (message); + const char *member = dbus_message_get_member (message); + + DBusMessage *reply = NULL; + + g_return_val_if_fail(iface != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED); + + if (!strcmp(iface, "org.freedesktop.atspi.Tree")) + { + if (!strcmp(member, "getRoot")) + { + reply = impl_getRoot(bus, message, user_data); + } + + if (!strcmp(member, "getTree")) + { + reply = impl_getTree(bus, message, user_data); + } + } + + if (!strcmp(iface, "org.freedesktop.DBus.Introspectable")) + { + if (!strcmp(member, "Introspect")) + { + reply = impl_introspect(bus, message, user_data); + } + } + + if (reply) + { + dbus_connection_send (bus, reply, NULL); + dbus_message_unref (reply); + } + + return DBUS_HANDLER_RESULT_HANDLED; +} + +static DBusObjectPathVTable tree_vtable = +{ + NULL, + &message_handler, + NULL, NULL, NULL, NULL }; void -spi_initialize_tree (DRouteData * data) +spi_register_tree_object(DBusConnection *bus, + DRouteData *data, + const char *path) { - droute_add_interface (data, "org.freedesktop.atspi.Tree", methods, - NULL, NULL, NULL); -}; + dbus_bool_t mem = FALSE; + mem = dbus_connection_register_object_path(bus, path, &tree_vtable, data); + g_assert(mem == TRUE); +} + static GHashTable *cache_list; #define UPDATE_NEW 1 -- 2.34.1