diff --git a/ChangeLog b/ChangeLog index 31ab589f1..10d5d6a66 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-01-14 Emmanuele Bassi + + * clutter.symbols: Add clutter_model_insertv() + + * clutter/clutter-model.[ch] (clutter_model_insertv): Add a vector + based insertion API, for language bindings + 2008-01-12 Emmanuele Bassi * clutter/clutter-effect.c (clutter_effect_rotate): Make the diff --git a/clutter.symbols b/clutter.symbols index 5448a8fcf..f19a02356 100644 --- a/clutter.symbols +++ b/clutter.symbols @@ -387,6 +387,7 @@ clutter_model_get_n_rows clutter_model_get_sorting_column clutter_model_get_type clutter_model_insert +clutter_model_insertv clutter_model_insert_value clutter_model_iter_get clutter_model_iter_get_model diff --git a/clutter/clutter-model.c b/clutter/clutter-model.c index 2c327b439..e26622acd 100644 --- a/clutter/clutter-model.c +++ b/clutter/clutter-model.c @@ -917,6 +917,57 @@ clutter_model_insert (ClutterModel *model, g_object_unref (iter); } +/** + * clutter_model_insertv: + * @model: a #ClutterModel + * @row: row index + * @n_columns: the number of columns and values to set + * @columns: a vector containing the columns to set + * @values: a vector containing the values for the cells + * + * Inserts data at @row into the #ClutterModel, setting the row + * values for the given @columns upon creation. + * + * Since: 0.6 + */ +void +clutter_model_insertv (ClutterModel *model, + guint row, + guint n_columns, + guint *columns, + GValue *values) +{ + ClutterModelPrivate *priv; + ClutterModelIter *iter; + gint i; + gboolean resort = FALSE; + + g_return_if_fail (CLUTTER_IS_MODEL (model)); + g_return_if_fail (n_columns <= clutter_model_get_n_columns (model)); + g_return_if_fail (columns != NULL); + g_return_if_fail (values != NULL); + + priv = model->priv; + + iter = CLUTTER_MODEL_GET_CLASS (model)->insert_row (model, row); + g_assert (CLUTTER_IS_MODEL_ITER (iter)); + + for (i = 0; i < n_columns; i++) + { + if (priv->sort_column == columns[i]) + resort = TRUE; + + clutter_model_iter_set_value (iter, columns[i], &values[i]); + } + + g_signal_emit (model, model_signals[ROW_ADDED], 0, iter); + + if (resort) + clutter_model_resort (model); + + g_object_unref (iter); +} + /** * clutter_model_insert_value: * @model: a #ClutterModel diff --git a/clutter/clutter-model.h b/clutter/clutter-model.h index 7f1f82070..f39900175 100644 --- a/clutter/clutter-model.h +++ b/clutter/clutter-model.h @@ -207,6 +207,11 @@ void clutter_model_prependv (ClutterModel *model, void clutter_model_insert (ClutterModel *model, guint row, ...); +void clutter_model_insertv (ClutterModel *model, + guint row, + guint n_columns, + guint *columns, + GValue *values); void clutter_model_insert_value (ClutterModel *model, guint row, guint column, diff --git a/doc/reference/ChangeLog b/doc/reference/ChangeLog index 59eaa84b9..94d88a849 100644 --- a/doc/reference/ChangeLog +++ b/doc/reference/ChangeLog @@ -1,3 +1,7 @@ +2008-01-14 Emmanuele Bassi + + * clutter-sections.txt: Add clutter_model_insertv() + 2008-01-09 Emmanuele Bassi * Makefile.am: Add clutter-model-private.h diff --git a/doc/reference/clutter-sections.txt b/doc/reference/clutter-sections.txt index 68a1d646e..7c66ee770 100644 --- a/doc/reference/clutter-sections.txt +++ b/doc/reference/clutter-sections.txt @@ -1164,6 +1164,7 @@ clutter_model_appendv clutter_model_prepend clutter_model_prependv clutter_model_insert +clutter_model_insertv clutter_model_insert_value clutter_model_remove