* 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
2002-04-18 Michael Meeks <michael@ximian.com>
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>
* libspi/Makefile.am: fix stateset install.
2002-04-17 Bill Haneman <bill.haneman@sun.com>
#include <config.h>
#include <stdio.h>
#include <config.h>
#include <stdio.h>
+#include <libspi/accessible.h>
#include <libspi/relation.h>
#include <libspi/relation.h>
AtkRelation *relation = get_relation_from_servant (servant);
AtkRelationType type;
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);
}
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);
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;
+}
const CORBA_short index,
CORBA_Environment * ev)
{
const CORBA_short index,
CORBA_Environment * ev)
{
AtkRelation *relation = get_relation_from_servant (servant);
g_return_val_if_fail (relation, NULL);
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);
+}