X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=atk-adaptor%2Fbridge.c;h=a1ee202adff10bd4ce56ff4770ce94b8b58f21c7;hb=770fcb6cf42143eebe5ebd9660a1c8737edaca6b;hp=6aacd121e9d7b01344260274c046fdbc3b433dcf;hpb=d0f7dd49eebedc8c3993a116411f5a8320965968;p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git diff --git a/atk-adaptor/bridge.c b/atk-adaptor/bridge.c index 6aacd12..a1ee202 100644 --- a/atk-adaptor/bridge.c +++ b/atk-adaptor/bridge.c @@ -44,16 +44,19 @@ #include "event.h" #include "adaptors.h" #include "object.h" -#include "common/spi-stateset.h" +#include "accessible-stateset.h" #include "accessible-register.h" #include "accessible-leasing.h" #include "accessible-cache.h" -#include "common/spi-dbus.h" +#include "spi-dbus.h" /*---------------------------------------------------------------------------*/ +static DBusHandlerResult +signal_filter (DBusConnection *bus, DBusMessage *message, void *user_data); + SpiBridge *spi_global_app_data = NULL; /*static Display *bridge_display = NULL;*/ @@ -143,8 +146,8 @@ get_registered_event_listeners (SpiBridge *app) DBusMessageIter iter, iter_array, iter_struct; message = dbus_message_new_method_call (SPI_DBUS_NAME_REGISTRY, - SPI_DBUS_PATH_REGISTRY, - SPI_DBUS_INTERFACE_REGISTRY, + ATSPI_DBUS_PATH_REGISTRY, + ATSPI_DBUS_INTERFACE_REGISTRY, "GetRegisteredEvents"); if (!message) return; @@ -235,12 +238,12 @@ register_application (SpiBridge * app) /* These will be overridden when we get a reply, but in practice these defaults should always be correct */ - app->desktop_name = SPI_DBUS_NAME_REGISTRY; - app->desktop_path = SPI_DBUS_PATH_ROOT; + app->desktop_name = ATSPI_DBUS_NAME_REGISTRY; + app->desktop_path = ATSPI_DBUS_PATH_ROOT; message = dbus_message_new_method_call (SPI_DBUS_NAME_REGISTRY, - SPI_DBUS_PATH_ROOT, - SPI_DBUS_INTERFACE_SOCKET, + ATSPI_DBUS_PATH_ROOT, + ATSPI_DBUS_INTERFACE_SOCKET, "Embed"); dbus_message_iter_init_append (message, &iter); @@ -285,8 +288,8 @@ deregister_application (SpiBridge * app) dbus_error_init (&error); message = dbus_message_new_method_call (SPI_DBUS_NAME_REGISTRY, - SPI_DBUS_PATH_REGISTRY, - SPI_DBUS_INTERFACE_REGISTRY, + ATSPI_DBUS_PATH_REGISTRY, + ATSPI_DBUS_INTERFACE_REGISTRY, "DeregisterApplication"); dbus_message_set_no_reply (message, TRUE); @@ -301,28 +304,6 @@ deregister_application (SpiBridge * app) /*---------------------------------------------------------------------------*/ -static void -exit_func (void) -{ - if (!spi_global_app_data) - { - return; - } - - spi_atk_tidy_windows (); - spi_atk_deregister_event_listeners (); - deregister_application (spi_global_app_data); - - g_free (spi_global_app_data); - spi_global_app_data = NULL; - - /* Not currently creating an XDisplay */ -#if 0 - if (bridge_display) - XCloseDisplay (bridge_display); -#endif -} - /*---------------------------------------------------------------------------*/ static AtkPlugClass *plug_class; @@ -353,33 +334,33 @@ socket_ref_state_set (AtkObject *accessible) DBusMessageIter iter, iter_array; AtkStateSet *set; + set = atk_state_set_new (); + if (!socket->embedded_plug_id) - return NULL; + return set; child_name = g_strdup (socket->embedded_plug_id); if (!child_name) - return NULL; + return set; child_path = g_utf8_strchr (child_name + 1, -1, ':'); if (!child_path) { g_free (child_name); - return NULL; + return set; } *(child_path++) = '\0'; - message = dbus_message_new_method_call (child_name, child_path, SPI_DBUS_INTERFACE_ACCESSIBLE, "GetState"); + message = dbus_message_new_method_call (child_name, child_path, ATSPI_DBUS_INTERFACE_ACCESSIBLE, "GetState"); g_free (child_name); reply = dbus_connection_send_with_reply_and_block (spi_global_app_data->bus, message, 1, NULL); dbus_message_unref (message); if (reply == NULL) - return NULL; + return set; if (strcmp (dbus_message_get_signature (reply), "au") != 0) { dbus_message_unref (reply); - return NULL; + return set; } - set = atk_state_set_new (); - if (!set) - return NULL; + dbus_message_iter_init (reply, &iter); dbus_message_iter_recurse (&iter, &iter_array); do @@ -421,7 +402,7 @@ socket_embed_hook (AtkSocket * socket, gchar * plug_id) { DBusMessage *message; *(plug_path++) = '\0'; - message = dbus_message_new_method_call (plug_name, plug_path, SPI_DBUS_INTERFACE_SOCKET, "Embedded"); + message = dbus_message_new_method_call (plug_name, plug_path, ATSPI_DBUS_INTERFACE_SOCKET, "Embedded"); dbus_message_append_args (message, DBUS_TYPE_STRING, &path, DBUS_TYPE_INVALID); dbus_connection_send (spi_global_app_data->bus, message, NULL); } @@ -498,9 +479,7 @@ new_connection_cb (DBusServer *server, DBusConnection *con, void *data) droute_intercept_dbus (con); droute_context_register (spi_global_app_data->droute, con); - new_list = g_list_append (spi_global_app_data->direct_connections, con); - if (new_list) - spi_global_app_data->direct_connections = new_list; + spi_global_app_data->direct_connections = g_list_append (spi_global_app_data->direct_connections, con); } static int @@ -628,7 +607,7 @@ signal_filter (DBusConnection *bus, DBusMessage *message, void *user_data) if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_SIGNAL) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - if (!strcmp (interface, SPI_DBUS_INTERFACE_REGISTRY)) + if (!strcmp (interface, ATSPI_DBUS_INTERFACE_REGISTRY)) { result = DBUS_HANDLER_RESULT_HANDLED; if (!strcmp (member, "EventListenerRegistered")) @@ -851,8 +830,53 @@ gnome_accessibility_module_init (void) void gnome_accessibility_module_shutdown (void) { + GList *l; + + if (!spi_global_app_data) + return; + + spi_atk_tidy_windows (); spi_atk_deregister_event_listeners (); - exit_func (); + + deregister_application (spi_global_app_data); + + if (spi_global_app_data->bus) + { + dbus_connection_remove_filter (spi_global_app_data->bus, signal_filter, NULL); + droute_context_unregister (spi_global_app_data->droute, spi_global_app_data->bus); + dbus_connection_unref (spi_global_app_data->bus); + } + + for (l = spi_global_app_data->direct_connections; l; l = l->next) + { + droute_context_unregister (spi_global_app_data->droute, l->data); + droute_unintercept_dbus (l->data); + dbus_connection_unref (l); + } + g_list_free (spi_global_app_data->direct_connections); + + for (l = clients; l; l = l->next) + g_free (l->data); + g_list_free (clients); + clients = NULL; + + g_object_unref (spi_global_cache); + g_object_unref (spi_global_leasing); + g_object_unref (spi_global_register); + + if (spi_global_app_data->main_context) + g_main_context_unref (spi_global_app_data->main_context); + + droute_free (spi_global_app_data->droute); + + g_free (spi_global_app_data); + spi_global_app_data = NULL; + + /* Not currently creating an XDisplay */ +#if 0 + if (bridge_display) + XCloseDisplay (bridge_display); +#endif } static gchar *name_match_tmpl =