diff options
author | John (J5) Palmieri <johnp@redhat.com> | 2010-04-27 17:12:41 -0400 |
---|---|---|
committer | John (J5) Palmieri <johnp@redhat.com> | 2010-05-03 12:47:38 -0400 |
commit | 33194ff5f46e39db123c8a4668d3a4b0bde48ecd (patch) | |
tree | ab4ab07186e2dcf0c90fff68f64c5ee210a5cca9 /gtk/gtktreemodel.c | |
parent | 5098f34234aa29cf496611bc7d41a7dcfac63743 (diff) | |
download | gtk+-33194ff5f46e39db123c8a4668d3a4b0bde48ecd.tar.gz |
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)
Diffstat (limited to 'gtk/gtktreemodel.c')
-rw-r--r-- | gtk/gtktreemodel.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gtk/gtktreemodel.c b/gtk/gtktreemodel.c index 5bdce35479..bf45a31f97 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. * |