From 8a0aee0b3f0c366111b04b20a1855194800b47db Mon Sep 17 00:00:00 2001 From: michael Date: Wed, 17 Apr 2002 23:21:28 +0000 Subject: [PATCH] 2002-04-18 Michael Meeks * 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 | 3 +++ libspi/relation.c | 22 +++++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 90a8809..21936d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2002-04-18 Michael Meeks + * libspi/relation.c (impl_getNTargets): impl. + (impl_getTarget): impl. + * libspi/Makefile.am: fix stateset install. 2002-04-17 Bill Haneman diff --git a/libspi/relation.c b/libspi/relation.c index c955317..817c5fc 100644 --- a/libspi/relation.c +++ b/libspi/relation.c @@ -24,6 +24,7 @@ #include #include +#include #include @@ -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 * -- 2.7.4