Fix handling of MATCH_ANY for empty statesets in a collection match rule
[platform/core/uifw/at-spi2-atk.git] / atk-adaptor / adaptors / accessible-adaptor.c
index 844ab6a..b40c5f9 100644 (file)
@@ -28,6 +28,7 @@
 #include "common/spi-dbus.h"
 #include "common/spi-stateset.h"
 #include "object.h"
+#include "introspection.h"
 
 static dbus_bool_t
 impl_get_Name (DBusMessageIter * iter, void *user_data)
@@ -91,7 +92,6 @@ impl_get_Parent (DBusMessageIter * iter, void *user_data)
   parent = atk_object_get_parent (obj);
   if (parent == NULL)
     {
-#ifdef SPI_ATK_PLUG_SOCKET
       /* TODO, move in to a 'Plug' wrapper. */
       if (ATK_IS_PLUG (obj))
         {
@@ -102,22 +102,27 @@ impl_get_Parent (DBusMessageIter * iter, void *user_data)
           if (id)
             {
               bus_parent = g_strdup (id);
-            if (bus_parent && (path_parent = g_utf8_strchr (bus_parent + 1, -1, ':')))
-              {
-                DBusMessageIter iter_parent;
-                *(path_parent++) = '\0';
-                dbus_message_iter_open_container (&iter_variant, DBUS_TYPE_STRUCT, NULL,
-                                                  &iter_parent);
-                dbus_message_iter_append_basic (&iter_parent, DBUS_TYPE_STRING, &bus_parent);
-                dbus_message_iter_append_basic (&iter_parent, DBUS_TYPE_OBJECT_PATH, &path_parent);
-                dbus_message_iter_close_container (&iter_variant, &iter_parent);
-              }
+              if (bus_parent && (path_parent = g_utf8_strchr (bus_parent + 1, -1, ':')))
+                {
+                  DBusMessageIter iter_parent;
+                  *(path_parent++) = '\0';
+                  dbus_message_iter_open_container (&iter_variant, DBUS_TYPE_STRUCT, NULL,
+                                                    &iter_parent);
+                  dbus_message_iter_append_basic (&iter_parent, DBUS_TYPE_STRING, &bus_parent);
+                  dbus_message_iter_append_basic (&iter_parent, DBUS_TYPE_OBJECT_PATH, &path_parent);
+                  dbus_message_iter_close_container (&iter_variant, &iter_parent);
+                }
+              else
+                {
+                  spi_object_append_null_reference (&iter_variant);
+                }
+            }
+          else
+            {
+              spi_object_append_null_reference (&iter_variant);
             }
         }
       else if (role != Accessibility_ROLE_APPLICATION)
-#else
-      if (role != Accessibility_ROLE_APPLICATION)
-#endif
          spi_object_append_null_reference (&iter_variant);
       else
          spi_object_append_desktop_reference (&iter_variant);
@@ -287,7 +292,9 @@ impl_GetRelationSet (DBusConnection * bus,
     {
       goto oom;
     }
-  count = atk_relation_set_get_n_relations (set);
+  count = 0;
+  if (set)
+    count = atk_relation_set_get_n_relations (set);
   for (i = 0; i < count; i++)
     {
       AtkRelation *r = atk_relation_set_get_relation (set, i);
@@ -489,27 +496,6 @@ impl_GetInterfaces (DBusConnection * bus,
   return reply;
 }
 
-static DBusMessage *
-impl_Embedded (DBusConnection *bus,
-                    DBusMessage *message,
-                    void *user_data)
-{
-  AtkObject *object = (AtkObject *) user_data;
-  char *path;
-  gchar *id;
-
-  if (!dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &path, DBUS_TYPE_INVALID))
-    {
-      return droute_invalid_arguments_error (message);
-    }
-  id = g_object_get_data (G_OBJECT (object), "dbus-plug-parent");
-  if (id)
-    g_free (id);
-  id = g_strconcat (dbus_message_get_sender (message), ":", path, NULL);
-  g_object_set_data (G_OBJECT (object), "dbus-plug-parent", id);
-  return dbus_message_new_method_return (message);
-}
-
 static DRouteMethod methods[] = {
   {impl_GetChildAtIndex, "GetChildAtIndex"},
   {impl_GetChildren, "GetChildren"},
@@ -522,7 +508,6 @@ static DRouteMethod methods[] = {
   {impl_GetAttributes, "GetAttributes"},
   {impl_GetApplication, "GetApplication"},
   {impl_GetInterfaces, "GetInterfaces"},
-  {impl_Embedded, "Embedded"},
   {NULL, NULL}
 };
 
@@ -539,5 +524,6 @@ spi_initialize_accessible (DRoutePath * path)
 {
   droute_path_add_interface (path,
                              SPI_DBUS_INTERFACE_ACCESSIBLE,
+                             spi_org_a11y_atspi_Accessible,    
                              methods, properties);
 };