Make sure the a11y hierarchy under an AtkPlug is generated when embedding.
[platform/core/uifw/at-spi2-atk.git] / atk-adaptor / adaptors / cache-adaptor.c
index 7eb69e4..e221920 100644 (file)
@@ -28,7 +28,8 @@
 #include <atk/atk.h>
 #include <droute/droute.h>
 
-#include "common/spi-dbus.h"
+#include "spi-dbus.h"
+#include "accessible-stateset.h"
 #include "accessible-cache.h"
 #include "bridge.h"
 #include "object.h"
@@ -131,7 +132,7 @@ append_cache_item (AtkObject * obj, gpointer data)
                 spi_object_append_null_reference (&iter_struct);
               }
           }
-        else if (role != Accessibility_ROLE_APPLICATION)
+        else if (role != ATSPI_ROLE_APPLICATION)
           spi_object_append_null_reference (&iter_struct);
         else
           spi_object_append_desktop_reference (&iter_struct);
@@ -144,7 +145,8 @@ append_cache_item (AtkObject * obj, gpointer data)
     /* Marshall children */
     dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "(so)",
                                       &iter_sub_array);
-    if (!atk_state_set_contains_state (set, ATK_STATE_MANAGES_DESCENDANTS))
+    if (!atk_state_set_contains_state (set, ATK_STATE_MANAGES_DESCENDANTS) &&
+        !atk_state_set_contains_state (set, ATK_STATE_DEFUNCT))
       {
         gint childcount, i;
 
@@ -236,7 +238,7 @@ emit_cache_remove (SpiCache *cache, GObject * obj)
   DBusMessage *message;
 
   if ((message = dbus_message_new_signal (SPI_CACHE_OBJECT_PATH,
-                                          SPI_DBUS_INTERFACE_CACHE,
+                                          ATSPI_DBUS_INTERFACE_CACHE,
                                           "RemoveAccessible")))
     {
       DBusMessageIter iter;
@@ -259,7 +261,7 @@ emit_cache_add (SpiCache *cache, GObject * obj)
   DBusMessage *message;
 
   if ((message = dbus_message_new_signal (SPI_CACHE_OBJECT_PATH,
-                                          SPI_DBUS_INTERFACE_CACHE,
+                                          ATSPI_DBUS_INTERFACE_CACHE,
                                           "AddAccessible")))
     {
       DBusMessageIter iter;
@@ -279,9 +281,7 @@ emit_cache_add (SpiCache *cache, GObject * obj)
 static DBusMessage *
 impl_GetRoot (DBusConnection * bus, DBusMessage * message, void *user_data)
 {
-  return spi_object_return_reference (message,
-                                      g_object_ref (G_OBJECT (spi_global_app_data->root)),
-                                      TRUE);
+  return spi_object_return_reference (message, spi_global_app_data->root);
 }
 
 /*---------------------------------------------------------------------------*/
@@ -292,6 +292,9 @@ impl_GetItems (DBusConnection * bus, DBusMessage * message, void *user_data)
   DBusMessage *reply;
   DBusMessageIter iter, iter_array;
 
+  if (bus == spi_global_app_data->bus)
+    spi_atk_add_client (dbus_message_get_sender (message));
+
   reply = dbus_message_new_method_return (message);
 
   dbus_message_iter_init_append (reply, &iter);
@@ -313,17 +316,13 @@ static DRouteMethod methods[] = {
 void
 spi_initialize_cache (DRoutePath * path)
 {
-  droute_path_add_interface (path, SPI_DBUS_INTERFACE_CACHE, spi_org_a11y_atspi_Cache, methods, NULL);
+  droute_path_add_interface (path, ATSPI_DBUS_INTERFACE_CACHE, spi_org_a11y_atspi_Cache, methods, NULL);
 
-  g_signal_connect (spi_global_cache,
-                    "object-added",
-                    (GCallback) emit_cache_add,
-                    NULL);
+  g_signal_connect (spi_global_cache, "object-added",
+                    (GCallback) emit_cache_add, NULL);
 
-  g_signal_connect (spi_global_cache,
-                    "object-removed",
-                    (GCallback) emit_cache_remove,
-                    NULL);
+  g_signal_connect (spi_global_cache, "object-removed",
+                    (GCallback) emit_cache_remove, NULL);
 };
 
 /*END------------------------------------------------------------------------*/