Replace DEPRECATED by @Deprecated in comments to fix warning when
authorPadraig O'Briain <padraig.obriain@sun.com>
Mon, 22 Nov 2004 13:21:18 +0000 (13:21 +0000)
committerPadraig O'Briain <padraigo@src.gnome.org>
Mon, 22 Nov 2004 13:21:18 +0000 (13:21 +0000)
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.

ChangeLog
atk/atkobject.c
atk/atkrelation.c
atk/atkrelation.h
atk/atkrelationset.c
atk/atkrelationset.h
docs/atk-sections.txt
docs/tmpl/atkrelation.sgml
docs/tmpl/atkrelationset.sgml

index dc10337..4f2b1ef 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+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.
+
 2004-11-17  Padraig O'Briain  <padraig.obriain@sun.com>
 
        * configure.in: Use gmodule-no-export.pc, requires glib 2.5.7.
index 2ca6636..2c17358 100755 (executable)
@@ -677,9 +677,10 @@ atk_object_get_role (AtkObject *accessible)
  * @accessible: an #AtkObject
  *
  * Gets the layer of the accessible.
- * DEPRECATED: use atk_component_get_layer instead!
  *
  * Returns: an #AtkLayer which is the layer of the accessible
+ *
+ * @Deprecated: Use atk_component_get_layer instead.
  **/
 AtkLayer
 atk_object_get_layer (AtkObject *accessible) 
@@ -701,11 +702,12 @@ atk_object_get_layer (AtkObject *accessible)
  *
  * Gets the zorder of the accessible. The value G_MININT will be returned 
  * if the layer of the accessible is not ATK_LAYER_MDI.
- * DEPRECATED: use atk_component_get_mdi_zorder instead!
  *
  * Returns: a gint which is the zorder of the accessible, i.e. the depth at 
  * which the component is shown in relation to other components in the same 
  * container.
+ *
+ * @Deprecated: Use atk_component_get_mdi_zorder instead.
  **/
 gint
 atk_object_get_mdi_zorder (AtkObject *accessible) 
index 6ed728e..3452526 100755 (executable)
@@ -304,6 +304,32 @@ delete_object_while_in_relation (gpointer callback_data,
   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 3e89702..08b0708 100755 (executable)
@@ -77,6 +77,9 @@ AtkRelationType       atk_relation_get_relation_type  (AtkRelation     *relation
  * 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 6847ea5..8308bc2 100755 (executable)
@@ -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);
+    }
+}
+
index fcfeb27..2225baf 100755 (executable)
@@ -67,6 +67,9 @@ AtkRelation*    atk_relation_set_get_relation         (AtkRelationSet  *set,
                                                        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
 }
index 9744c1b..755ca85 100644 (file)
@@ -254,6 +254,7 @@ atk_relation_type_for_name
 atk_relation_new
 atk_relation_get_relation_type
 atk_relation_get_target
+atk_relation_add_target
 <SUBSECTION Standard>
 ATK_RELATION
 ATK_IS_RELATION
@@ -278,6 +279,7 @@ atk_relation_set_add
 atk_relation_set_get_n_relations
 atk_relation_set_get_relation
 atk_relation_set_get_relation_by_type
+atk_relation_set_add_relation_by_type
 <SUBSECTION Standard>
 ATK_RELATION_SET
 ATK_IS_RELATION_SET
index 657872d..4d0f412 100644 (file)
@@ -103,6 +103,15 @@ The AtkRelation structure should not be accessed directly.
 @Returns: 
 
 
+<!-- ##### FUNCTION atk_relation_add_target ##### -->
+<para>
+
+</para>
+
+@relation: 
+@target: 
+
+
 <!-- ##### ARG AtkRelation:relation-type ##### -->
 <para>
 
index e4e2f36..ec8c673 100644 (file)
@@ -86,3 +86,13 @@ The AtkRelationSet structure should not be accessed directly.
 @Returns: 
 
 
+<!-- ##### FUNCTION atk_relation_set_add_relation_by_type ##### -->
+<para>
+
+</para>
+
+@set: 
+@relationship: 
+@target: 
+
+