2002-04-18 Michael Meeks <michael@ximian.com>
authormichael <michael@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Wed, 17 Apr 2002 23:21:28 +0000 (23:21 +0000)
committermichael <michael@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Wed, 17 Apr 2002 23:21:28 +0000 (23:21 +0000)
* libspi/relation.c (impl_getNTargets): impl.
(impl_getTarget): impl.

* libspi/Makefile.am: fix stateset install.

git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@280 e2bd861d-eb25-0410-b326-f6ed22b6b98c

ChangeLog
libspi/relation.c

index 90a8809..21936d0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2002-04-18  Michael Meeks  <michael@ximian.com>
 
+       * libspi/relation.c (impl_getNTargets): impl.
+       (impl_getTarget): impl.
+
        * libspi/Makefile.am: fix stateset install.
 
 2002-04-17  Bill Haneman <bill.haneman@sun.com>
index c955317..817c5fc 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <config.h>
 #include <stdio.h>
+#include <libspi/accessible.h>
 #include <libspi/relation.h>
 
 
@@ -83,21 +84,21 @@ impl_getRelationType (PortableServer_Servant servant,
   AtkRelation *relation = get_relation_from_servant (servant);
   AtkRelationType type;
 
-  g_return_val_if_fail (relation, 0);
+  g_return_val_if_fail (relation != NULL, 0);
   type = atk_relation_get_relation_type (relation);
   return spi_relation_type_from_atk_relation_type (type);
 }
 
 
-
 static CORBA_short
 impl_getNTargets (PortableServer_Servant servant,
                  CORBA_Environment * ev)
 {
   AtkRelation *relation = get_relation_from_servant(servant);
-  g_return_val_if_fail (relation, 0);
-}
+  g_return_val_if_fail (relation != NULL, 0);
 
+  return relation->target ? relation->target->len : 0;
+}
 
 
 static CORBA_Object
@@ -105,10 +106,21 @@ impl_getTarget (PortableServer_Servant servant,
                const CORBA_short index,
                CORBA_Environment * ev)
 {
+  AtkObject *atk_object;
   AtkRelation *relation = get_relation_from_servant (servant);
   g_return_val_if_fail (relation, NULL);
-}
 
+  if (!relation->target ||
+      index < 0 ||
+      index >= relation->target->len)
+    return CORBA_OBJECT_NIL;
+
+  atk_object = g_ptr_array_index (relation->target, index);
+  if (!atk_object)
+    return CORBA_OBJECT_NIL;
+
+  return spi_accessible_new_return (atk_object, FALSE, ev);
+}
 
 
 SpiRelation *