X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=atk-adaptor%2Fbridge.c;h=e1782aa2ccc9e8ccf0b6b7b34a3ad002f8029277;hb=3e1f56f6e2c63ad90e13214ac13a2dc848e925b5;hp=361d52bff8bd293c9993cef196ddff4deb650839;hpb=57dab4183ae4e23d60a6b19cc269372616774a56;p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git diff --git a/atk-adaptor/bridge.c b/atk-adaptor/bridge.c index 361d52b..e1782aa 100644 --- a/atk-adaptor/bridge.c +++ b/atk-adaptor/bridge.c @@ -148,7 +148,7 @@ register_application (SpiAppData *app) message = dbus_message_new_method_call (SPI_DBUS_NAME_REGISTRY, SPI_DBUS_PATH_REGISTRY, SPI_DBUS_INTERFACE_REGISTRY, - "registerApplication"); + "RegisterApplication"); dbus_message_set_no_reply (message, TRUE); uname = dbus_bus_get_unique_name(app->bus); @@ -174,7 +174,7 @@ deregister_application (SpiAppData *app) message = dbus_message_new_method_call (SPI_DBUS_NAME_REGISTRY, SPI_DBUS_PATH_REGISTRY, SPI_DBUS_INTERFACE_REGISTRY, - "deregisterApplication"); + "DeregisterApplication"); dbus_message_set_no_reply (message, TRUE); uname = dbus_bus_get_unique_name(app->bus); @@ -211,6 +211,47 @@ exit_func (void) /*---------------------------------------------------------------------------*/ +#ifdef __ATK_PLUG_H__ +static AtkPlugClass *plug_class; +static AtkSocketClass *socket_class; + +static gchar * +get_plug_id (AtkPlug *plug) +{ + const char *uname = dbus_bus_get_unique_name(atk_adaptor_app_data->bus); + gchar *path; + GString *str = g_string_new (NULL); + + path = atk_dbus_object_to_path (ATK_OBJECT(plug), TRUE); + g_string_printf (str, "%s:%s", uname, path); + g_free (path); + return g_string_free (str, FALSE); +} + +static void +socket_embed_hook (AtkSocket *socket, gchar *plug_id) +{ + AtkObject *accessible = ATK_OBJECT(socket); + /* Force registration */ + gchar *path = atk_dbus_object_to_path (accessible, TRUE); + spi_emit_cache_update (accessible, atk_adaptor_app_data->bus); + g_free (path); +} + +static void +install_plug_hooks () +{ + gpointer data; + + data = g_type_class_ref (ATK_TYPE_PLUG); + plug_class = ATK_PLUG_CLASS (data); + data = g_type_class_ref (ATK_TYPE_SOCKET); + socket_class = ATK_SOCKET_CLASS (data); + plug_class->get_object_id = get_plug_id; + socket_class->embed = socket_embed_hook; +} +#endif + static gchar *atspi_dbus_name; static gboolean atspi_no_register; @@ -240,6 +281,12 @@ adaptor_init (gint *argc, gchar **argv[]) DBusConnection *bus; AtkObject *root; gchar *introspection_directory; + static gboolean inited = FALSE; + + if (inited) + return 0; + + inited = TRUE; DRoutePath *treepath, *accpath; @@ -291,7 +338,7 @@ adaptor_init (gint *argc, gchar **argv[]) accpath = droute_add_many (atk_adaptor_app_data->droute, "/org/freedesktop/atspi/accessible", NULL, - (DRouteGetDatumFunction) atk_dbus_path_to_object); + (DRouteGetDatumFunction) atk_dbus_path_to_gobject); /* Register all interfaces with droute and set up application accessible db */ spi_initialize_tree (treepath); @@ -317,6 +364,11 @@ adaptor_init (gint *argc, gchar **argv[]) /* Register methods to send D-Bus signals on certain ATK events */ spi_atk_register_event_listeners (); +#ifdef __ATK_PLUG_H__ + /* Hook our plug-and socket functions */ + install_plug_hooks (); +#endif + /* Register this app by sending a signal out to AT-SPI registry daemon */ register_application (atk_adaptor_app_data); @@ -336,6 +388,29 @@ gtk_module_init (gint *argc, gchar **argv[]) { return adaptor_init (argc, argv); } + return 0; } +void +gnome_accessibility_module_init (void) +{ + const gchar *load_bridge = g_getenv ("NO_AT_BRIDGE"); + + if (!load_bridge || g_ascii_strtod (load_bridge, NULL) == 0) + { + adaptor_init (NULL, NULL); + + if (g_getenv ("AT_SPI_DEBUG")) + { + g_print("Atk Accessibility bridge initialized\n"); + } + } +} + +void +gnome_accessibility_module_shutdown (void) +{ + spi_atk_deregister_event_listeners (); + exit_func (); +} /*END------------------------------------------------------------------------*/