[atk] Fix introspection for atk_text_get_bounded_ranges



commit c0a9b468cfd2b8a422a49b3d75c852d38e64db12
Author: Mike Gorse <mgorse novell com>
Date:   Tue Feb 22 11:33:46 2011 -0600

    Fix introspection for atk_text_get_bounded_ranges

 atk/atktext.c |   30 ++++++++++++++++++++++++++----
 atk/atktext.h |    2 ++
 2 files changed, 28 insertions(+), 4 deletions(-)
---
diff --git a/atk/atktext.c b/atk/atktext.c
index ee3abde..76b36d9 100755
--- a/atk/atktext.c
+++ b/atk/atktext.c
@@ -966,7 +966,7 @@ atk_text_get_range_extents (AtkText          *text,
 /**
  * atk_text_get_bounded_ranges:
  * @text: an #AtkText
- * @rect: An AtkTextRectagle giving the dimensions of the bounding box.
+ * @rect: An AtkTextRectangle giving the dimensions of the bounding box.
  * @coord_type: Specify whether coordinates are relative to the screen or widget window.
  * @x_clip_type: Specify the horizontal clip type.
  * @y_clip_type: Specify the vertical clip type.
@@ -975,8 +975,8 @@ atk_text_get_range_extents (AtkText          *text,
  *
  * Since: 1.3
  *
- * Returns: Array of AtkTextRange. The last element of the array returned 
- *          by this function will be NULL.
+ * Returns: (array zero-terminated=1): Array of AtkTextRange. The last
+ *          element of the array returned by this function will be NULL.
  **/
 AtkTextRange**
 atk_text_get_bounded_ranges (AtkText          *text,
@@ -1365,10 +1365,32 @@ atk_text_free_ranges (AtkTextRange **ranges)
           AtkTextRange *range;
 
           range = *ranges;
-          *ranges++;
+          ranges++;
           g_free (range->content);
           g_free (range);
         }
       g_free (first);
     }
 }
+
+static AtkTextRange *
+atk_text_range_copy (AtkTextRange *src)
+{
+  AtkTextRange *dst = g_new0 (AtkTextRange, 1);
+  dst->bounds = src->bounds;
+  dst->start_offset = src->start_offset;
+  dst->end_offset = src->end_offset;
+  if (src->content)
+    dst->content = g_strdup (src->content);
+  return dst;
+}
+
+static void
+atk_text_range_free (AtkTextRange *range)
+{
+  g_free (range->content);
+  g_free (range);
+}
+
+G_DEFINE_BOXED_TYPE (AtkTextRange, atk_text_range, atk_text_range_copy,
+                     atk_text_range_free)
diff --git a/atk/atktext.h b/atk/atktext.h
index 1b7a038..285f1ac 100755
--- a/atk/atktext.h
+++ b/atk/atktext.h
@@ -174,6 +174,8 @@ struct _AtkTextRange {
   gchar* content;
 };
 
+GType atk_text_range_get_type ();
+
 /**
  *AtkTextClipType
  * ATK_TEXT_CLIP_NONE: No clipping to be done



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]