Index: atkrelation.c
===================================================================
RCS file: /cvs/gnome/atk/atk/atkrelation.c,v
retrieving revision 1.19
diff -u -p -r1.19 atkrelation.c
--- atkrelation.c	11 May 2004 08:03:41 -0000	1.19
+++ atkrelation.c	22 Nov 2004 09:12:42 -0000
@@ -304,6 +304,32 @@ delete_object_while_in_relation (gpointe
   g_ptr_array_remove (array, where_the_object_was);
 }
 
+/**
+ * atk_relation_add_target:
+ * @relation: an #AtkRelation
+ * @target: an #AtkObject
+ *
+ * Adds the specified AtkObject to the target for the relation, if it is
+ * not already present.
+ **/
+void
+atk_relation_add_target (AtkRelation *relation,
+                         AtkObject   *target)
+{
+  guint i;
+
+  g_return_if_fail (ATK_IS_RELATION (relation));
+  g_return_if_fail (ATK_IS_OBJECT (target));
+
+  /* first check if target occurs in array ... */
+  for (i = 0; i < relation->target->len; i++)
+    if (g_ptr_array_index(relation->target, i) == target)
+      return;
+
+  g_ptr_array_add (relation->target, target);
+  g_object_weak_ref (G_OBJECT (target), (GWeakNotify) delete_object_while_in_relation, relation->target);
+}
+
 static void
 atk_relation_finalize (GObject *object)
 {
Index: atkrelation.h
===================================================================
RCS file: /cvs/gnome/atk/atk/atkrelation.h,v
retrieving revision 1.8
diff -u -p -r1.8 atkrelation.h
--- atkrelation.h	30 Oct 2002 09:42:27 -0000	1.8
+++ atkrelation.h	22 Nov 2004 09:12:42 -0000
@@ -77,6 +77,9 @@ AtkRelationType       atk_relation_get_r
  * Returns the target list of a relation.
  */
 GPtrArray*            atk_relation_get_target         (AtkRelation     *relation);
+void                  atk_relation_add_target         (AtkRelation     *relation,
+                                                       AtkObject       *target);
+                
 
 #ifdef __cplusplus
 }
Index: atkrelationset.c
===================================================================
RCS file: /cvs/gnome/atk/atk/atkrelationset.c,v
retrieving revision 1.11
diff -u -p -r1.11 atkrelationset.c
--- atkrelationset.c	6 Mar 2003 08:49:48 -0000	1.11
+++ atkrelationset.c	22 Nov 2004 09:12:42 -0000
@@ -264,3 +264,40 @@ atk_relation_set_finalize (GObject *obje
 
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
+
+/**
+ * atk_relation_set_add_relation_by_type:
+ * @set: an #AtkRelationSet
+ * @relationship: an #AtkRelationType
+ * @target: an #AtkObject
+ *
+ * Add a new relation of the specified type with the specified target to 
+ * the current relation set if the relation set does not contain a relation
+ * of that type. If it is does contain a relation of that typea the target
+ * is added to the relation.
+ **/
+void
+atk_relation_set_add_relation_by_type (AtkRelationSet  *set,
+                                       AtkRelationType relationship,
+                                       AtkObject       *target)
+{
+  AtkRelation *relation;
+
+  g_return_if_fail (ATK_IS_RELATION_SET (set));
+  g_return_if_fail (ATK_IS_OBJECT (target));
+
+  relation = atk_relation_set_get_relation_by_type (set,
+                                                    relationship);
+  if (relation)
+    {
+      atk_relation_add_target (relation, target);
+    } 
+  else 
+    {
+      /* the relation hasn't been created yet ... */
+      relation = atk_relation_new (&target, 1, relationship);
+      atk_relation_set_add (set, relation);
+      g_object_unref(relation);
+    }
+}
+
Index: atkrelationset.h
===================================================================
RCS file: /cvs/gnome/atk/atk/atkrelationset.h,v
retrieving revision 1.4
diff -u -p -r1.4 atkrelationset.h
--- atkrelationset.h	13 Feb 2002 14:15:05 -0000	1.4
+++ atkrelationset.h	22 Nov 2004 09:12:42 -0000
@@ -67,6 +67,9 @@ AtkRelation*    atk_relation_set_get_rel
                                                        gint            i);
 AtkRelation*    atk_relation_set_get_relation_by_type (AtkRelationSet  *set,
                                                        AtkRelationType relationship);
+void            atk_relation_set_add_relation_by_type (AtkRelationSet  *set,
+                                                       AtkRelationType relationship,
+                                                       AtkObject       *target);
 
 #ifdef __cplusplus
 }
