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
This commit is contained in:
Simon Feltman 2012-09-24 16:34:56 -07:00 committed by Simon Feltman
parent e7437515cf
commit ab13787985
2 changed files with 42 additions and 0 deletions

View File

@ -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,

View File

@ -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