summaryrefslogtreecommitdiff
path: root/atk/atkrelation.c
diff options
context:
space:
mode:
authorLi Yuan <li.yuan@sun.com>2008-11-11 07:17:06 +0000
committerLi Yuan <liyuan@src.gnome.org>2008-11-11 07:17:06 +0000
commit12e1d4fc27f2d5e99f45ed2648e0ff42fe3c6ab3 (patch)
treea97f38a8abcd6f36bcfebf66a470bda98f4832f6 /atk/atkrelation.c
parentc90838ac55aec8bc698e9b960bf3c9de07d8dd8e (diff)
downloadatk-12e1d4fc27f2d5e99f45ed2648e0ff42fe3c6ab3.tar.gz
Bug #477708. Only remove the target, not the relation if there are still
2008-11-10 Li Yuan <li.yuan@sun.com> * atk/atkobject.c: (atk_object_remove_relationship): Bug #477708. Only remove the target, not the relation if there are still are targets. * atk/atkrelation.c: (atk_relation_remove_target): * atk/atkrelation.h: New API. * atk/atkrelationset.c: (atk_relation_set_add), (atk_relation_set_remove): Add/remove the new relation's targets to/from the existed relation if there has been a relation with the same type. * atk/atkstateset.c: (atk_state_set_or_sets): Bug #478595. Return NULL if sets are empty. svn path=/trunk/; revision=1297
Diffstat (limited to 'atk/atkrelation.c')
-rwxr-xr-xatk/atkrelation.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/atk/atkrelation.c b/atk/atkrelation.c
index 92000c9..970d947 100755
--- a/atk/atkrelation.c
+++ b/atk/atkrelation.c
@@ -333,6 +333,35 @@ atk_relation_add_target (AtkRelation *relation,
g_object_weak_ref (G_OBJECT (target), (GWeakNotify) delete_object_while_in_relation, relation->target);
}
+/**
+ * atk_relation_remove_target:
+ * @relation: an #AtkRelation
+ * @target: an #AtkObject
+ *
+ * Remove the specified AtkObject from the target for the relation.
+ *
+ * Returns TRUE if the removal is successful.
+ **/
+
+gboolean
+atk_relation_remove_target (AtkRelation *relation,
+ AtkObject *target)
+{
+ gboolean ret = FALSE;
+ GPtrArray *array;
+
+ array = atk_relation_get_target (relation);
+
+ if (array && g_ptr_array_remove (array, target))
+ {
+ g_object_weak_unref (G_OBJECT (target),
+ (GWeakNotify) delete_object_while_in_relation,
+ relation->target);
+ ret = TRUE;
+ }
+ return ret;
+}
+
static void
atk_relation_finalize (GObject *object)
{