Have atspi_accessible_get_relation_set return a GPtrArray
authorMike Gorse <mgorse@novell.com>
Sun, 31 Jul 2011 22:17:01 +0000 (17:17 -0500)
committerMike Gorse <mgorse@novell.com>
Sun, 31 Jul 2011 22:17:01 +0000 (17:17 -0500)
gobject-introspection/pygobject is not handling GArrays returning
GObject pointers very well (BGO#655127), so committing this change, at
least for now.  It is an API break, but afaik no one is currently
calling libatspi directly with pyatspi being the only consumer...

atspi/atspi-accessible.c
atspi/atspi-accessible.h

index 29e4083..5b7cdf6 100644 (file)
@@ -519,10 +519,10 @@ typedef struct
  * Get the set of #AtspiRelation objects which describe this #AtspiAccessible object's
  *       relationships with other #AtspiAccessible objects.
  *
- * Returns: (element-type AtspiAccessible*) (transfer full): an array of
+ * Returns: (element-type AtspiRelation*) (transfer full): an array of
  *          #AtspiAccessibleRelation pointers. or NULL on exception
  **/
-GArray *
+GPtrArray *
 atspi_accessible_get_relation_set (AtspiAccessible *obj, GError **error)
 {
   DBusMessage *reply;
@@ -536,14 +536,14 @@ atspi_accessible_get_relation_set (AtspiAccessible *obj, GError **error)
     return NULL;
   _ATSPI_DBUS_CHECK_SIG (reply, "a(ua(so))", error, NULL);
 
-  ret = g_array_new (TRUE, TRUE, sizeof (AtspiRelation *));
+  ret = g_ptr_array_new ();
   dbus_message_iter_init (reply, &iter);
   dbus_message_iter_recurse (&iter, &iter_array);
   while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID)
   {
     AtspiRelation *relation;
     relation = _atspi_relation_new_from_iter (&iter_array);
-    ret = g_array_append_val (ret, relation);
+    g_ptr_array_add (ret, relation);
     dbus_message_iter_next (&iter_array);
   }
   dbus_message_unref (reply);
index d9deffe..5dd1aab 100644 (file)
@@ -80,7 +80,7 @@ AtspiAccessible * atspi_accessible_get_child_at_index (AtspiAccessible *obj, gin
 
 gint atspi_accessible_get_index_in_parent (AtspiAccessible *obj, GError **error);
 
-GArray * atspi_accessible_get_relation_set (AtspiAccessible *obj, GError **error);
+GPtrArray * atspi_accessible_get_relation_set (AtspiAccessible *obj, GError **error);
 
 AtspiRole atspi_accessible_get_role (AtspiAccessible *obj, GError **error);