2008-01-07 Emmanuele Bassi <ebassi@openedhand.com>

* 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
This commit is contained in:
Emmanuele Bassi 2008-01-07 17:17:43 +00:00
parent 28ef76edfa
commit 09263f94b0
7 changed files with 85 additions and 33 deletions

View File

@ -1,3 +1,19 @@
2008-01-07 Emmanuele Bassi <ebassi@openedhand.com>
* 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 <ebassi@openedhand.com>
* clutter.symbols: Add clutter_actor_move_byu()

View File

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

View File

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

View File

@ -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,
...);

View File

@ -1,3 +1,9 @@
2008-01-07 Emmanuele Bassi <ebassi@openedhand.com>
* 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 <ebassi@openedhand.com>
* clutter-sections.txt: Add clutter_actor_move_byu()

View File

@ -1160,9 +1160,9 @@ clutter_model_get_n_rows
<SUBSECTION>
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

View File

@ -1,7 +1,7 @@
#include <stdlib.h>
#include <clutter/clutter.h>
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);