[gtk+] add a get_indices_with_depth method to GtkTreePath with proper GI array annotations



commit 33194ff5f46e39db123c8a4668d3a4b0bde48ecd
Author: John (J5) Palmieri <johnp redhat com>
Date:   Tue Apr 27 17:12:41 2010 -0400

    add a get_indices_with_depth method to GtkTreePath with proper GI array annotations
    
    * get_indices does not return a length so we can not annotate it to return an
      array in bindings that use GObject Introspection
    * this method is the same as get_indices except it takes an int * as the depth
      parameter which we can then use in the array annotation
    * in C this function returns an integer pointer array and updates depth to the
      number of integers in the array
    * in a GI binding this returns the native array type for the bound language
      (e.g. in PyGI this returns a list of integers)

 docs/reference/gtk/gtk-sections.txt       |    1 +
 docs/reference/gtk/tmpl/gtktreemodel.sgml |   10 ++++++++++
 gtk/gtk.symbols                           |    1 +
 gtk/gtktreemodel.c                        |   25 +++++++++++++++++++++++++
 gtk/gtktreemodel.h                        |    4 ++++
 5 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gtk/gtk-sections.txt b/docs/reference/gtk/gtk-sections.txt
index b523590..684b30d 100644
--- a/docs/reference/gtk/gtk-sections.txt
+++ b/docs/reference/gtk/gtk-sections.txt
@@ -4675,6 +4675,7 @@ gtk_tree_path_append_index
 gtk_tree_path_prepend_index
 gtk_tree_path_get_depth
 gtk_tree_path_get_indices
+gtk_tree_path_get_indices_with_depth
 gtk_tree_path_free
 gtk_tree_path_copy
 gtk_tree_path_compare
diff --git a/docs/reference/gtk/tmpl/gtktreemodel.sgml b/docs/reference/gtk/tmpl/gtktreemodel.sgml
index e16a9fd..d635009 100644
--- a/docs/reference/gtk/tmpl/gtktreemodel.sgml
+++ b/docs/reference/gtk/tmpl/gtktreemodel.sgml
@@ -412,6 +412,16 @@ compatibility reasons.
 @Returns: 
 
 
+<!-- ##### FUNCTION gtk_tree_path_get_indices_with_depth ##### -->
+<para>
+
+</para>
+
+ path:
+ depth: 
+ Returns: 
+
+
 <!-- ##### FUNCTION gtk_tree_path_free ##### -->
 <para>
 
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index ccda448..a285bfd 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -4671,6 +4671,7 @@ gtk_tree_path_down
 gtk_tree_path_free
 gtk_tree_path_get_depth
 gtk_tree_path_get_indices
+gtk_tree_path_get_indices_with_depth
 gtk_tree_path_get_type G_GNUC_CONST
 gtk_tree_path_is_ancestor
 gtk_tree_path_is_descendant
diff --git a/gtk/gtktreemodel.c b/gtk/gtktreemodel.c
index 5bdce35..bf45a31 100644
--- a/gtk/gtktreemodel.c
+++ b/gtk/gtktreemodel.c
@@ -623,6 +623,31 @@ gtk_tree_path_get_indices (GtkTreePath *path)
 }
 
 /**
+ * gtk_tree_path_get_indices_with_depth:
+ * @path: A #GtkTreePath.
+ * @depth: Number of elements returned in the integer array
+ *
+ * Returns the current indices of @path.
+ * This is an array of integers, each representing a node in a tree.
+ * It also returns the number of elements in the array.
+ * The array should not be freed.
+ *
+ * Return value: (array length=depth): The current indices, or %NULL.
+ *
+ * Since: 3.0
+ **/
+gint *
+gtk_tree_path_get_indices_with_depth (GtkTreePath *path, gint *depth)
+{
+  g_return_val_if_fail (path != NULL, NULL);
+
+  if (depth)
+    *depth = path->depth;
+
+  return path->indices;
+}
+
+/**
  * gtk_tree_path_free:
  * @path: A #GtkTreePath.
  *
diff --git a/gtk/gtktreemodel.h b/gtk/gtktreemodel.h
index b48e87b..ba0fe4e 100644
--- a/gtk/gtktreemodel.h
+++ b/gtk/gtktreemodel.h
@@ -134,6 +134,10 @@ void         gtk_tree_path_prepend_index    (GtkTreePath       *path,
 					     gint               index_);
 gint         gtk_tree_path_get_depth        (GtkTreePath       *path);
 gint        *gtk_tree_path_get_indices      (GtkTreePath       *path);
+
+gint        *gtk_tree_path_get_indices_with_depth (GtkTreePath *path,
+						   gint        *depth);
+
 void         gtk_tree_path_free             (GtkTreePath       *path);
 GtkTreePath *gtk_tree_path_copy             (const GtkTreePath *path);
 GType        gtk_tree_path_get_type         (void) G_GNUC_CONST;



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