diff --git a/ChangeLog b/ChangeLog index 892ebed30..5620283b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2008-01-07 Emmanuele Bassi + + * clutter/clutter-model.h: + * clutter/clutter-model.c: + (clutter_model_appendv), + (clutter_model_prependv): Add vector based API for bindings. + + (clutter_model_get_column_name), + (clutter_model_get_column_type), + (clutter_model_set_sorting_column): Fix the check in the condition + on the column index. + + * tests/test-scale.c (on_timeline_completed), (main): Fix spelling + + * clutter.symbols: Update public symbols + 2008-01-04 Emmanuele Bassi * clutter.symbols: Add clutter_actor_move_byu() diff --git a/clutter.symbols b/clutter.symbols index e170ec1b7..4b6222039 100644 --- a/clutter.symbols +++ b/clutter.symbols @@ -372,6 +372,7 @@ clutter_media_get_type clutter_media_get_uri clutter_media_get_volume clutter_model_append +clutter_model_appendv clutter_model_foreach clutter_model_get_column_name clutter_model_get_column_type @@ -400,6 +401,7 @@ clutter_model_iter_set_value clutter_model_new clutter_model_newv clutter_model_prepend +clutter_model_prependv clutter_model_set_filter clutter_model_set_names clutter_model_set_sort diff --git a/clutter/clutter-model.c b/clutter/clutter-model.c index 756fba767..9f981b1b8 100644 --- a/clutter/clutter-model.c +++ b/clutter/clutter-model.c @@ -775,36 +775,49 @@ clutter_model_get_n_columns (ClutterModel *model) } /** - * clutter_model_append_value: + * clutter_model_appendv: * @model: a #ClutterModel - * @column: the column to set - * @value: the value of the cell + * @n_columns: the number of columns and values + * @columns: a vector with the columns to set + * @values: a vector with the values * * Creates and appends a new row to the #ClutterModel, setting the row - * value for the given @column upon creation. + * values for the given @columns upon creation. * * Since: 0.6 */ void -clutter_model_append_value (ClutterModel *model, - guint column, - const GValue *value) +clutter_model_appendv (ClutterModel *model, + 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, -1); g_assert (CLUTTER_IS_MODEL_ITER (iter)); - clutter_model_iter_set_value (iter, column, value); + 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 (priv->sort_column == column) + if (resort) clutter_model_resort (model); g_object_unref (iter); @@ -853,36 +866,49 @@ clutter_model_append (ClutterModel *model, } /** - * clutter_model_prepend_value: + * clutter_model_prependv: * @model: a #ClutterModel - * @column: column to set - * @value: new value for the cell + * @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 * * Creates and prepends a new row to the #ClutterModel, setting the row - * value for the given @column upon creation. + * values for the given @columns upon creation. * * Since: 0.6 */ void -clutter_model_prepend_value (ClutterModel *model, - guint column, - const GValue *value) +clutter_model_prependv (ClutterModel *model, + 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, 0); g_assert (CLUTTER_IS_MODEL_ITER (iter)); - clutter_model_iter_set_value (iter, column, value); + 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 (priv->sort_column == column) + if (resort) clutter_model_resort (model); g_object_unref (iter); @@ -1068,7 +1094,7 @@ clutter_model_get_column_name (ClutterModel *model, g_return_val_if_fail (CLUTTER_IS_MODEL (model), NULL); priv = model->priv; - if (column < 0 || column > clutter_model_get_n_columns (model)) + if (column < 0 || column >= clutter_model_get_n_columns (model)) { g_warning ("%s: Invalid column id value %d\n", G_STRLOC, column); return NULL; @@ -1102,7 +1128,7 @@ clutter_model_get_column_type (ClutterModel *model, g_return_val_if_fail (CLUTTER_IS_MODEL (model), G_TYPE_INVALID); priv = model->priv; - if (column < 0 || column > clutter_model_get_n_columns (model)) + if (column < 0 || column >= clutter_model_get_n_columns (model)) { g_warning ("%s: Invalid column id value %d\n", G_STRLOC, column); return G_TYPE_INVALID; @@ -1225,7 +1251,7 @@ clutter_model_set_sorting_column (ClutterModel *model, g_return_if_fail (CLUTTER_IS_MODEL (model)); priv = model->priv; - if (column > clutter_model_get_n_columns (model)) + if (column >= clutter_model_get_n_columns (model)) { g_warning ("%s: Invalid column id value %d\n", G_STRLOC, column); return; diff --git a/clutter/clutter-model.h b/clutter/clutter-model.h index c71c42b65..7f1f82070 100644 --- a/clutter/clutter-model.h +++ b/clutter/clutter-model.h @@ -194,14 +194,16 @@ void clutter_model_set_names (ClutterModel *model, void clutter_model_append (ClutterModel *model, ...); -void clutter_model_append_value (ClutterModel *model, - guint column, - const GValue *value); +void clutter_model_appendv (ClutterModel *model, + guint n_columns, + guint *columns, + GValue *values); void clutter_model_prepend (ClutterModel *model, ...); -void clutter_model_prepend_value (ClutterModel *model, - guint column, - const GValue *value); +void clutter_model_prependv (ClutterModel *model, + guint n_columns, + guint *columns, + GValue *values); void clutter_model_insert (ClutterModel *model, guint row, ...); diff --git a/doc/reference/ChangeLog b/doc/reference/ChangeLog index 2f144207b..18ce3897b 100644 --- a/doc/reference/ChangeLog +++ b/doc/reference/ChangeLog @@ -1,3 +1,9 @@ +2008-01-07 Emmanuele Bassi + + * clutter-sections.txt: Remove clutter_model_append_value() + and clutter_model_prepend_value(), and add clutter_model_appendv() + and clutter_model_prependv(). + 2008-01-04 Emmanuele Bassi * clutter-sections.txt: Add clutter_actor_move_byu() diff --git a/doc/reference/clutter-sections.txt b/doc/reference/clutter-sections.txt index 9c1a2a647..550594cdc 100644 --- a/doc/reference/clutter-sections.txt +++ b/doc/reference/clutter-sections.txt @@ -1160,9 +1160,9 @@ clutter_model_get_n_rows clutter_model_append -clutter_model_append_value +clutter_model_appendv clutter_model_prepend -clutter_model_prepend_value +clutter_model_prependv clutter_model_insert clutter_model_insert_value clutter_model_remove diff --git a/tests/test-scale.c b/tests/test-scale.c index c46e66c59..27621a75a 100644 --- a/tests/test-scale.c +++ b/tests/test-scale.c @@ -1,7 +1,7 @@ #include #include -ClutterGravity gravitys[] = { +ClutterGravity gravities[] = { CLUTTER_GRAVITY_NORTH_EAST, CLUTTER_GRAVITY_NORTH, CLUTTER_GRAVITY_NORTH_WEST, @@ -22,10 +22,10 @@ on_timeline_completed (ClutterTimeline *cluttertimeline, { ClutterBehaviourScale *behave = CLUTTER_BEHAVIOUR_SCALE(data); - if (++gindex >= G_N_ELEMENTS(gravitys)) + if (++gindex >= G_N_ELEMENTS (gravities)) gindex = 0; - g_object_set (behave, "scale-gravity", gravitys[gindex], NULL); + g_object_set (behave, "scale-gravity", gravities[gindex], NULL); } int @@ -66,7 +66,7 @@ main (int argc, char *argv[]) behave = clutter_behaviour_scale_new (alpha, 0.0, 1.0, - gravitys[gindex]); + gravities[gindex]); clutter_behaviour_apply (behave, rect);