[gtk+] Add introspection friendly version of gtk_tree_path_new_from_indices



commit efa8956718386b29ecd37aa11e1a827656b66616
Author: Simon Feltman <sfeltman src gnome org>
Date:   Fri Aug 16 03:59:30 2013 -0700

    Add introspection friendly version of gtk_tree_path_new_from_indices
    
    Add gtk_tree_path_new_from_indicesv which takes an array of
    integers with a length. Use "Rename to" annotation to rename the
    method as gtk_tree_path_new_from_indices. This is needed because
    the original method takes variadic arguments which is not supported
    by introspection.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=706119

 docs/reference/gtk/gtk3-sections.txt |    1 +
 gtk/gtktreemodel.c                   |   28 ++++++++++++++++++++++++++++
 gtk/gtktreemodel.h                   |    3 +++
 3 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index aaa9c8e..d4fe0cb 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -4244,6 +4244,7 @@ GtkTreeModelFlags
 gtk_tree_path_new
 gtk_tree_path_new_from_string
 gtk_tree_path_new_from_indices
+gtk_tree_path_new_from_indicesv
 gtk_tree_path_to_string
 gtk_tree_path_new_first
 gtk_tree_path_append_index
diff --git a/gtk/gtktreemodel.c b/gtk/gtktreemodel.c
index 1a8a9fc..b519001 100644
--- a/gtk/gtktreemodel.c
+++ b/gtk/gtktreemodel.c
@@ -682,6 +682,34 @@ gtk_tree_path_new_from_indices (gint first_index,
 }
 
 /**
+ * gtk_tree_path_new_from_indicesv: (rename-to gtk_tree_path_new_from_indices)
+ * @indices: (array length=length): array of indices
+ * @length: length of @indices array
+ *
+ * Creates a new path with the given @indices array of @length.
+ *
+ * Return value: A newly created #GtkTreePath
+ *
+ * Since: 3.12
+ */
+GtkTreePath *
+gtk_tree_path_new_from_indicesv (gint *indices,
+                                 gsize length)
+{
+  GtkTreePath *path;
+
+  g_return_val_if_fail (indices != NULL && length != 0, NULL);
+
+  path = gtk_tree_path_new ();
+  path->alloc = length;
+  path->depth = length;
+  path->indices = g_new (gint, length);
+  memcpy (path->indices, indices, length * sizeof (gint));
+
+  return path;
+}
+
+/**
  * gtk_tree_path_to_string:
  * @path: A #GtkTreePath
  *
diff --git a/gtk/gtktreemodel.h b/gtk/gtktreemodel.h
index e1ebde5..a1cccc2 100644
--- a/gtk/gtktreemodel.h
+++ b/gtk/gtktreemodel.h
@@ -167,6 +167,9 @@ GtkTreePath *gtk_tree_path_new_from_string  (const gchar       *path);
 GDK_AVAILABLE_IN_ALL
 GtkTreePath *gtk_tree_path_new_from_indices (gint               first_index,
                                             ...);
+GDK_AVAILABLE_IN_3_12
+GtkTreePath *gtk_tree_path_new_from_indicesv (gint             *indices,
+                                             gsize             length);
 GDK_AVAILABLE_IN_ALL
 gchar       *gtk_tree_path_to_string        (GtkTreePath       *path);
 GDK_AVAILABLE_IN_ALL


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