[gtk+] Add gtk_tree_model_rows_reordered_with_length introspectable method



commit ab1378798522a97d6111e55df1e1dd6531e7f1d3
Author: Simon Feltman <s feltman gmail com>
Date:   Mon Sep 24 16:34:56 2012 -0700

    Add gtk_tree_model_rows_reordered_with_length introspectable method
    
    Add introspection friendly version of gtk_tree_model_rows_reordered
    with a "_with_length" suffix. This allows language bindings to
    safely pass an array with length argument. Use the "Rename to:"
    annotation to expose as "gtk_tree_model_rows_reordered".
    
    https://bugzilla.gnome.org/show_bug.cgi?id=684558

 gtk/gtktreemodel.c |   36 ++++++++++++++++++++++++++++++++++++
 gtk/gtktreemodel.h |    6 ++++++
 2 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtktreemodel.c b/gtk/gtktreemodel.c
index 31d8843..b4f8ef0 100644
--- a/gtk/gtktreemodel.c
+++ b/gtk/gtktreemodel.c
@@ -1895,6 +1895,42 @@ gtk_tree_model_rows_reordered (GtkTreeModel *tree_model,
   g_signal_emit (tree_model, tree_model_signals[ROWS_REORDERED], 0, path, iter, new_order);
 }
 
+/**
+ * gtk_tree_model_rows_reordered_with_length:
+ * @tree_model: a #GtkTreeModel
+ * @path: a #GtkTreePath pointing to the tree node whose children
+ *     have been reordered
+ * @iter: (allow-none): a valid #GtkTreeIter pointing to the node
+ *     whose children have been reordered, or %NULL if the depth
+ *     of @path is 0
+ * @new_order: (array length=length): an array of integers
+ *     mapping the current position of each child to its old
+ *     position before the re-ordering,
+ *     i.e. @new_order<literal>[newpos] = oldpos</literal>
+ * @length: length of @new_order array
+ *
+ * Emits the #GtkTreeModel::rows-reordered signal on @tree_model.
+ *
+ * This should be called by models when their rows have been
+ * reordered.
+ *
+ * Rename to: gtk_tree_model_rows_reordered
+ *
+ * Since: 3.10
+ */
+void
+gtk_tree_model_rows_reordered_with_length (GtkTreeModel *tree_model,
+                                           GtkTreePath  *path,
+                                           GtkTreeIter  *iter,
+                                           gint         *new_order,
+                                           gint          length)
+{
+  g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
+  g_return_if_fail (new_order != NULL);
+  g_return_if_fail (length == gtk_tree_model_iter_n_children (tree_model, iter));
+
+  g_signal_emit (tree_model, tree_model_signals[ROWS_REORDERED], 0, path, iter, new_order);
+}
 
 static gboolean
 gtk_tree_model_foreach_helper (GtkTreeModel            *model,
diff --git a/gtk/gtktreemodel.h b/gtk/gtktreemodel.h
index 41a4d2b..e1ebde5 100644
--- a/gtk/gtktreemodel.h
+++ b/gtk/gtktreemodel.h
@@ -361,6 +361,12 @@ void gtk_tree_model_rows_reordered        (GtkTreeModel *tree_model,
                                           GtkTreePath  *path,
                                           GtkTreeIter  *iter,
                                           gint         *new_order);
+GDK_AVAILABLE_IN_3_10
+void gtk_tree_model_rows_reordered_with_length (GtkTreeModel *tree_model,
+                                               GtkTreePath  *path,
+                                               GtkTreeIter  *iter,
+                                               gint         *new_order,
+                                               gint          length);
 
 G_END_DECLS
 


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