summaryrefslogtreecommitdiff
path: root/atk/atkrelationset.c
diff options
context:
space:
mode:
authorPadraig O'Briain <padraig.obriain@sun.com>2004-11-22 13:21:18 +0000
committerPadraig O'Briain <padraigo@src.gnome.org>2004-11-22 13:21:18 +0000
commit44d21d4402a64f7ca60b84e8543e205f585d207f (patch)
tree9cd544e6d4acad38183ed94dc3790c2c51d0b9a9 /atk/atkrelationset.c
parent46270d7db51b3808ffc2aa0324272159bb6e792c (diff)
downloadatk-44d21d4402a64f7ca60b84e8543e205f585d207f.tar.gz
Replace DEPRECATED by @Deprecated in comments to fix warning when
2004-11-22 Padraig O'Briain <padraig.obriain@sun.com> * atk/atkobject.c: Replace DEPRECATED by @Deprecated in comments to fix warning when documentation is generated. * atk/atkrelation.[ch]: * docs/tmpl/atkrelation.sgml: Add atk_relation_add_target. * atk/atkrelationset.[ch]: * atk/tmpl/atkrelationset.sgml: Add atk_relation_add_relation_by_type. * docs/atk-sections.txt: Add atk_relation_add_target and atk_relation_add_relation_by_type. Fixes bug #158722.
Diffstat (limited to 'atk/atkrelationset.c')
-rwxr-xr-xatk/atkrelationset.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/atk/atkrelationset.c b/atk/atkrelationset.c
index 6847ea5..8308bc2 100755
--- a/atk/atkrelationset.c
+++ b/atk/atkrelationset.c
@@ -264,3 +264,40 @@ atk_relation_set_finalize (GObject *object)
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);
+ }
+}
+