2007-12-15 Emmanuele Bassi <ebassi@openedhand.com>

* clutter/clutter-model-default.c:
	(clutter_model_default_iter_next),
	(clutter_model_default_iter_prev): Do not instantiate a new
	iterator, and update the passed one instead, as we say we do
	in the documentation. This avoid leaking tons of iterators.

	* clutter/clutter-model.[ch]: Update the documentation.

	* tests/test-model.c: Prettify some output.
This commit is contained in:
Emmanuele Bassi 2007-12-15 13:02:06 +00:00
parent 6193beb8be
commit afaa4fe26f
7 changed files with 213 additions and 132 deletions

View File

@ -1,3 +1,15 @@
2007-12-15 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-model-default.c:
(clutter_model_default_iter_next),
(clutter_model_default_iter_prev): Do not instantiate a new
iterator, and update the passed one instead, as we say we do
in the documentation. This avoid leaking tons of iterators.
* clutter/clutter-model.[ch]: Update the documentation.
* tests/test-model.c: Prettify some output.
2007-12-14 Emmanuele Bassi <ebassi@openedhand.com> 2007-12-14 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-behaviour.c: * clutter/clutter-behaviour.c:

View File

@ -26,7 +26,7 @@
*/ */
/** /**
* SECTION:clutter-model-default: * SECTION:clutter-model-default
* @short_description: Default model implementation * @short_description: Default model implementation
* *
* #ClutterModelDefault is a #ClutterModel implementation provided by * #ClutterModelDefault is a #ClutterModel implementation provided by
@ -313,7 +313,6 @@ static ClutterModelIter *
clutter_model_default_iter_next (ClutterModelIter *iter) clutter_model_default_iter_next (ClutterModelIter *iter)
{ {
ClutterModelDefaultIter *iter_default; ClutterModelDefaultIter *iter_default;
ClutterModelDefaultIter *retval;
ClutterModelIter *temp_iter; ClutterModelIter *temp_iter;
ClutterModel *model = NULL; ClutterModel *model = NULL;
GSequenceIter *filter_next; GSequenceIter *filter_next;
@ -352,20 +351,17 @@ clutter_model_default_iter_next (ClutterModelIter *iter)
if (filter_next == iter_default->seq_iter) if (filter_next == iter_default->seq_iter)
filter_next = g_sequence_iter_next (filter_next); filter_next = g_sequence_iter_next (filter_next);
retval = g_object_new (CLUTTER_TYPE_MODEL_DEFAULT_ITER, /* update the iterator and return it */
"model", model, g_object_set (G_OBJECT (iter_default), "model", model, "row", row, NULL);
"row", row, iter_default->seq_iter = filter_next;
NULL);
retval->seq_iter = filter_next;
return CLUTTER_MODEL_ITER (retval); return CLUTTER_MODEL_ITER (iter_default);
} }
static ClutterModelIter * static ClutterModelIter *
clutter_model_default_iter_prev (ClutterModelIter *iter) clutter_model_default_iter_prev (ClutterModelIter *iter)
{ {
ClutterModelDefaultIter *iter_default; ClutterModelDefaultIter *iter_default;
ClutterModelDefaultIter *retval;
ClutterModelIter *temp_iter; ClutterModelIter *temp_iter;
ClutterModel *model; ClutterModel *model;
GSequenceIter *filter_prev; GSequenceIter *filter_prev;
@ -404,13 +400,11 @@ clutter_model_default_iter_prev (ClutterModelIter *iter)
if (filter_prev == iter_default->seq_iter) if (filter_prev == iter_default->seq_iter)
filter_prev = g_sequence_iter_prev (filter_prev); filter_prev = g_sequence_iter_prev (filter_prev);
retval = g_object_new (CLUTTER_TYPE_MODEL_DEFAULT_ITER, /* update the iterator and return it */
"model", model, g_object_set (G_OBJECT (iter_default), "model", model, "row", row, NULL);
"row", row, iter_default->seq_iter = filter_prev;
NULL);
retval->seq_iter = filter_prev;
return CLUTTER_MODEL_ITER (retval); return CLUTTER_MODEL_ITER (iter_default);
} }
static void static void
clutter_model_default_iter_class_init (ClutterModelDefaultIterClass *klass) clutter_model_default_iter_class_init (ClutterModelDefaultIterClass *klass)

View File

@ -245,9 +245,9 @@ clutter_model_class_init (ClutterModelClass *klass)
* @model: the #ClutterModel on which the signal is emitted * @model: the #ClutterModel on which the signal is emitted
* @iter: a #ClutterModelIter pointing to the new row * @iter: a #ClutterModelIter pointing to the new row
* *
* The ::row-added signal is emitted when a new row has been added * The ::row-added signal is emitted when a new row has been added.
* *
* Since 0.6 * Since: 0.6
*/ */
model_signals[ROW_ADDED] = model_signals[ROW_ADDED] =
g_signal_new ("row-added", g_signal_new ("row-added",
@ -263,9 +263,10 @@ clutter_model_class_init (ClutterModelClass *klass)
* @model: the #ClutterModel on which the signal is emitted * @model: the #ClutterModel on which the signal is emitted
* @iter: a #ClutterModelIter pointing to the removed row * @iter: a #ClutterModelIter pointing to the removed row
* *
* The ::row-removed signal is emitted when a row has been removed * The ::row-removed signal is emitted when a row has been removed.
* The data on the row pointed by the passed iterator is still valid.
* *
* Since 0.6 * Since: 0.6
*/ */
model_signals[ROW_REMOVED] = model_signals[ROW_REMOVED] =
g_signal_new ("row-removed", g_signal_new ("row-removed",
@ -283,7 +284,7 @@ clutter_model_class_init (ClutterModelClass *klass)
* *
* The ::row-removed signal is emitted when a row has been changed * The ::row-removed signal is emitted when a row has been changed
* *
* Since 0.6 * Since: 0.6
*/ */
model_signals[ROW_CHANGED] = model_signals[ROW_CHANGED] =
g_signal_new ("row-changed", g_signal_new ("row-changed",
@ -300,7 +301,7 @@ clutter_model_class_init (ClutterModelClass *klass)
* *
* The ::sort-changed signal is emitted after the model has been sorted * The ::sort-changed signal is emitted after the model has been sorted
* *
* Since 0.6 * Since: 0.6
*/ */
model_signals[SORT_CHANGED] = model_signals[SORT_CHANGED] =
g_signal_new ("sort-changed", g_signal_new ("sort-changed",
@ -316,7 +317,7 @@ clutter_model_class_init (ClutterModelClass *klass)
* *
* The ::filter-changed signal is emitted when a new filter has been applied * The ::filter-changed signal is emitted when a new filter has been applied
* *
* Since 0.6 * Since: 0.6
*/ */
model_signals[FILTER_CHANGED] = model_signals[FILTER_CHANGED] =
g_signal_new ("filter-changed", g_signal_new ("filter-changed",
@ -536,8 +537,9 @@ clutter_model_set_column_name (ClutterModel *model,
/* we implement the constructors of the default model here because /* we implement the constructors of the default model here because
* we need the private accessors to the column names and types * we need the private accessors to the column names and types
* vectors inside ClutterModelPrivate; the ClutterModelDefault ctors * vectors inside ClutterModelPrivate, to avoid having them inside
* are declared inside clutter-model-default.h * a private header; the ClutterModelDefault ctors are declared inside
* clutter-model-default.h
*/ */
/** /**
@ -560,9 +562,13 @@ clutter_model_set_column_name (ClutterModel *model,
* will create a new #ClutterModel with three columns of type int, * will create a new #ClutterModel with three columns of type int,
* string and #GdkPixbuf respectively. * string and #GdkPixbuf respectively.
* *
* Return value: a new #ClutterModel * Note that the name of the column can be set to %NULL, in which case
* the canonical name of the type held by the column will be used as
* the title.
* *
* Since 0.6 * Return value: a new default #ClutterModel
*
* Since: 0.6
*/ */
ClutterModel * ClutterModel *
clutter_model_default_new (guint n_columns, clutter_model_default_new (guint n_columns,
@ -606,11 +612,12 @@ clutter_model_default_new (guint n_columns,
* @types: an array of #GType types for the columns, from first to last * @types: an array of #GType types for the columns, from first to last
* @names: an array of names for the columns, from first to last * @names: an array of names for the columns, from first to last
* *
* Non-vararg creation function. Useful primarily by language bindings. * Non-vararg version of clutter_model_default_new(). This function is
* useful for language bindings.
* *
* Return value: a new #ClutterModel * Return value: a new default #ClutterModel
* *
* Since 0.6 * Since: 0.6
*/ */
ClutterModel * ClutterModel *
clutter_model_default_newv (guint n_columns, clutter_model_default_newv (guint n_columns,
@ -653,12 +660,12 @@ clutter_model_default_newv (guint n_columns,
* #ClutterModel, and should only be used when contructing a #ClutterModel. * #ClutterModel, and should only be used when contructing a #ClutterModel.
* It will not work after the initial creation of the #ClutterModel. * It will not work after the initial creation of the #ClutterModel.
* *
* Since 0.6 * Since: 0.6
*/ */
void void
clutter_model_set_types (ClutterModel *model, clutter_model_set_types (ClutterModel *model,
guint n_columns, guint n_columns,
GType *types) GType *types)
{ {
ClutterModelPrivate *priv; ClutterModelPrivate *priv;
gint i; gint i;
@ -748,7 +755,7 @@ clutter_model_get_n_columns (ClutterModel *model)
* Creates and appends a new row to the #ClutterModel, setting the row * Creates and appends a new row to the #ClutterModel, setting the row
* value for the given @column upon creation. * value for the given @column upon creation.
* *
* Since 0.6 * Since: 0.6
*/ */
void void
clutter_model_append_value (ClutterModel *model, clutter_model_append_value (ClutterModel *model,
@ -787,12 +794,12 @@ clutter_model_append_value (ClutterModel *model,
* <informalexample><programlisting> * <informalexample><programlisting>
* ClutterModel *model; * ClutterModel *model;
* model = clutter_model_default_new (2, * model = clutter_model_default_new (2,
* G_TYPE_INT, "My integers", * G_TYPE_INT, "Score",
* G_TYPE_STRING, "My strings"); * G_TYPE_STRING, "Team");
* clutter_model_append (model, 0, 42, 1, "string", -1); * clutter_model_append (model, 0, 42, 1, "Team #1", -1);
* </programlisting></informalexample> * </programlisting></informalexample>
* *
* Since 0.6 * Since: 0.6
*/ */
void void
clutter_model_append (ClutterModel *model, clutter_model_append (ClutterModel *model,
@ -826,7 +833,7 @@ clutter_model_append (ClutterModel *model,
* Creates and prepends a new row to the #ClutterModel, setting the row * Creates and prepends a new row to the #ClutterModel, setting the row
* value for the given @column upon creation. * value for the given @column upon creation.
* *
* Since 0.6 * Since: 0.6
*/ */
void void
clutter_model_prepend_value (ClutterModel *model, clutter_model_prepend_value (ClutterModel *model,
@ -865,12 +872,12 @@ clutter_model_prepend_value (ClutterModel *model,
* <informalexample><programlisting> * <informalexample><programlisting>
* ClutterModel *model; * ClutterModel *model;
* model = clutter_model_default_new (2, * model = clutter_model_default_new (2,
* G_TYPE_INT, "My integers", * G_TYPE_INT, "Score",
* G_TYPE_STRING, "My strings"); * G_TYPE_STRING, "Team");
* clutter_model_prepend (model, 0, 42, 1, "string", -1); * clutter_model_prepend (model, 0, 42, 1, "Team #1", -1);
* </programlisting></informalexample> * </programlisting></informalexample>
* *
* Since 0.6 * Since: 0.6
*/ */
void void
clutter_model_prepend (ClutterModel *model, clutter_model_prepend (ClutterModel *model,
@ -908,12 +915,12 @@ clutter_model_prepend (ClutterModel *model,
* <informalexample><programlisting> * <informalexample><programlisting>
* ClutterModel *model; * ClutterModel *model;
* model = clutter_model_default_new (2, * model = clutter_model_default_new (2,
* G_TYPE_INT, "My integers", * G_TYPE_INT, "Score",
* G_TYPE_STRING, "My strings"); * G_TYPE_STRING, "Team");
* clutter_model_insert (model, 100, 0, 42, 1, "string", -1); * clutter_model_insert (model, 3, 0, 42, 1, "Team #1", -1);
* </programlisting></informalexample> * </programlisting></informalexample>
* *
* Since 0.6 * Since: 0.6
*/ */
void void
clutter_model_insert (ClutterModel *model, clutter_model_insert (ClutterModel *model,
@ -951,7 +958,7 @@ clutter_model_insert (ClutterModel *model,
* @value must be convertable to the type of the column. If the row does * @value must be convertable to the type of the column. If the row does
* not exist then it is created. * not exist then it is created.
* *
* Since 0.6 * Since: 0.6
*/ */
void void
clutter_model_insert_value (ClutterModel *model, clutter_model_insert_value (ClutterModel *model,
@ -996,7 +1003,7 @@ clutter_model_insert_value (ClutterModel *model,
* *
* Removes the row at the given position from the model. * Removes the row at the given position from the model.
* *
* Since 0.6 * Since: 0.6
*/ */
void void
clutter_model_remove (ClutterModel *model, clutter_model_remove (ClutterModel *model,
@ -1085,12 +1092,14 @@ clutter_model_get_column_type (ClutterModel *model,
* @model: a #ClutterModel * @model: a #ClutterModel
* @row: position of the row to retrieve * @row: position of the row to retrieve
* *
* Retrieves a #ClutterModelIter representing the row at the given position. * Retrieves a #ClutterModelIter representing the row at the given index.
* *
* Return value: A new #ClutterModelIter, or %NULL if @row was out-of-bounds * Return value: A new #ClutterModelIter, or %NULL if @row was out of bounds.
* When done using the iterator object, call g_object_unref() to deallocate
* its resources
* *
* Since 0.6 * Since: 0.6
**/ */
ClutterModelIter * ClutterModelIter *
clutter_model_get_iter_at_row (ClutterModel *model, clutter_model_get_iter_at_row (ClutterModel *model,
guint row) guint row)
@ -1113,10 +1122,11 @@ clutter_model_get_iter_at_row (ClutterModel *model,
* *
* Retrieves a #ClutterModelIter representing the first row in @model. * Retrieves a #ClutterModelIter representing the first row in @model.
* *
* Return value: A new #ClutterModelIter * Return value: A new #ClutterModelIter. Call g_object_unref() when
* done using it
* *
* Since 0.6 * Since: 0.6
**/ */
ClutterModelIter * ClutterModelIter *
clutter_model_get_first_iter (ClutterModel *model) clutter_model_get_first_iter (ClutterModel *model)
{ {
@ -1131,10 +1141,11 @@ clutter_model_get_first_iter (ClutterModel *model)
* *
* Retrieves a #ClutterModelIter representing the last row in @model. * Retrieves a #ClutterModelIter representing the last row in @model.
* *
* Return value: A new #ClutterModelIter * Return value: A new #ClutterModelIter. Call g_object_unref() when
* done using it
* *
* Since 0.6 * Since: 0.6
**/ */
ClutterModelIter * ClutterModelIter *
clutter_model_get_last_iter (ClutterModel *model) clutter_model_get_last_iter (ClutterModel *model)
{ {
@ -1156,7 +1167,7 @@ clutter_model_get_last_iter (ClutterModel *model)
* Return value: The length of the @model. If there is a filter set, then * Return value: The length of the @model. If there is a filter set, then
* the length of the filtered @model is returned. * the length of the filtered @model is returned.
* *
* Since 0.6 * Since: 0.6
*/ */
guint guint
clutter_model_get_n_rows (ClutterModel *model) clutter_model_get_n_rows (ClutterModel *model)
@ -1200,7 +1211,7 @@ clutter_model_get_n_rows (ClutterModel *model)
* Sets the model to sort by @column. If @column is a negative value * Sets the model to sort by @column. If @column is a negative value
* the sorting column will be unset. * the sorting column will be unset.
* *
* Since 0.6 * Since: 0.6
*/ */
void void
clutter_model_set_sorting_column (ClutterModel *model, clutter_model_set_sorting_column (ClutterModel *model,
@ -1233,7 +1244,7 @@ clutter_model_set_sorting_column (ClutterModel *model,
* *
* Return value: a column number, or -1 if the model is not sorted * Return value: a column number, or -1 if the model is not sorted
* *
* Since 0.6 * Since: 0.6
*/ */
gint gint
clutter_model_get_sorting_column (ClutterModel *model) clutter_model_get_sorting_column (ClutterModel *model)
@ -1251,7 +1262,7 @@ clutter_model_get_sorting_column (ClutterModel *model)
* *
* Calls @func for each row in the model. * Calls @func for each row in the model.
* *
* Since 0.6 * Since: 0.6
*/ */
void void
clutter_model_foreach (ClutterModel *model, clutter_model_foreach (ClutterModel *model,
@ -1288,9 +1299,9 @@ clutter_model_foreach (ClutterModel *model,
* @user_data: user data to pass to @func, or #NULL * @user_data: user data to pass to @func, or #NULL
* @notify: destroy notifier of @user_data, or #NULL * @notify: destroy notifier of @user_data, or #NULL
* *
* Sorts the @model using @func. * Sorts @model using the given sorting function.
* *
* Since 0.6 * Since: 0.6
*/ */
void void
clutter_model_set_sort (ClutterModel *model, clutter_model_set_sort (ClutterModel *model,
@ -1322,9 +1333,9 @@ clutter_model_set_sort (ClutterModel *model,
* @user_data: user data to pass to @func, or #NULL * @user_data: user data to pass to @func, or #NULL
* @notify: destroy notifier of @user_data, or #NULL * @notify: destroy notifier of @user_data, or #NULL
* *
* Filters the @model using @func. * Filters the @model using the given filtering function.
* *
* Since 0.6 * Since: 0.6
*/ */
void void
clutter_model_set_filter (ClutterModel *model, clutter_model_set_filter (ClutterModel *model,
@ -1589,28 +1600,26 @@ clutter_model_iter_init (ClutterModelIter *self)
* @iter: a #ClutterModelIter * @iter: a #ClutterModelIter
* @args: va_list of column/value pairs, terminiated by -1 * @args: va_list of column/value pairs, terminiated by -1
* *
* See #clutter_model_iter_set; this version takes a va_list for language * See clutter_model_iter_set(); this version takes a va_list for language
* bindings. * bindings.
* *
* Since 0.6 * Since: 0.6
*/ */
void void
clutter_model_iter_set_valist (ClutterModelIter *iter, clutter_model_iter_set_valist (ClutterModelIter *iter,
va_list args) va_list args)
{ {
ClutterModel *model; ClutterModel *model;
ClutterModelPrivate *model_priv;
ClutterModelIterPrivate *priv; ClutterModelIterPrivate *priv;
guint column = 0; guint column = 0;
gboolean sort = FALSE; gboolean sort = FALSE;
g_return_if_fail (CLUTTER_IS_MODEL_ITER (iter)); g_return_if_fail (CLUTTER_IS_MODEL_ITER (iter));
priv = iter->priv; priv = iter->priv;
model = priv->model; model = priv->model;
g_assert (CLUTTER_IS_MODEL (model));
g_return_if_fail (CLUTTER_IS_MODEL (model));
model_priv = model->priv;
column = va_arg (args, gint); column = va_arg (args, gint);
/* Don't want to sort while setting lots of fields, leave that till the end /* Don't want to sort while setting lots of fields, leave that till the end
@ -1621,14 +1630,14 @@ clutter_model_iter_set_valist (ClutterModelIter *iter,
GValue value = { 0, }; GValue value = { 0, };
gchar *error = NULL; gchar *error = NULL;
if (column < 0 || column >= model_priv->n_columns) if (column < 0 || column >= clutter_model_get_n_columns (model))
{ {
g_warning ("%s: Invalid column number %d added to iter " g_warning ("%s: Invalid column number %d added to iter "
"(remember to end you list of columns with a -1)", "(remember to end you list of columns with a -1)",
G_STRLOC, column); G_STRLOC, column);
break; break;
} }
g_value_init (&value, model_priv->column_types[column]); g_value_init (&value, clutter_model_get_column_type (model, column));
G_VALUE_COLLECT (&value, args, 0, &error); G_VALUE_COLLECT (&value, args, 0, &error);
if (error) if (error)
@ -1644,7 +1653,7 @@ clutter_model_iter_set_valist (ClutterModelIter *iter,
g_value_unset (&value); g_value_unset (&value);
if (column == model_priv->sort_column) if (column == clutter_model_get_sorting_column (model))
sort = TRUE; sort = TRUE;
column = va_arg (args, gint); column = va_arg (args, gint);
@ -1660,18 +1669,22 @@ clutter_model_iter_set_valist (ClutterModelIter *iter,
/** /**
* clutter_model_iter_get: * clutter_model_iter_get:
* @iter: a #ClutterModelIter * @iter: a #ClutterModelIter
* @Varargs: va_list of column/return location pairs, terminiated by -1 * @Varargs: a list of column/return location pairs, terminated by -1
* *
* Gets the value of one or more cells in the row referenced by @iter. The * Gets the value of one or more cells in the row referenced by @iter. The
* variable argument list should contain integer column numbers, each column * variable argument list should contain integer column numbers, each column
* column number followed by a place to store the value being retrieved. The * column number followed by a place to store the value being retrieved. The
* list is terminated by a -1. For example, to get a value from column 0 * list is terminated by a -1.
* with type G_TYPE_STRING, you would write: <literal>clutter_model_iter_get
* (iter, 0, &place_string_here, -1);</literal>, where place_string_here is
* a gchar* to be filled with the string. If appropriate, the returned values
* have to be freed or unreferenced.
* *
* Since 0.6 * For example, to get a value from column 0 with type %G_TYPE_STRING use:
* <informalexample><programlisting>
* clutter_model_iter_get (iter, 0, &place_string_here, -1);
* </programlisting></informalexample>
*
* where place_string_here is a gchar* to be filled with the string. If
* appropriate, the returned values have to be freed or unreferenced.
*
* Since: 0.6
*/ */
void void
clutter_model_iter_get (ClutterModelIter *iter, clutter_model_iter_get (ClutterModelIter *iter,
@ -1693,9 +1706,9 @@ clutter_model_iter_get (ClutterModelIter *iter,
* @value: an empty #GValue to set * @value: an empty #GValue to set
* *
* Sets an initializes @value to that at @column. When done with @value, * Sets an initializes @value to that at @column. When done with @value,
* #g_value_unset() needs to be called to free any allocated memory. * g_value_unset() needs to be called to free any allocated memory.
* *
* Since 0.6 * Since: 0.6
*/ */
void void
clutter_model_iter_get_value (ClutterModelIter *iter, clutter_model_iter_get_value (ClutterModelIter *iter,
@ -1719,29 +1732,27 @@ clutter_model_iter_get_value (ClutterModelIter *iter,
/** /**
* clutter_model_iter_get_valist: * clutter_model_iter_get_valist:
* @iter: a #ClutterModelIter * @iter: a #ClutterModelIter
* @args: va_list of column/return location pairs, terminiated by -1 * @args: a list of column/return location pairs, terminated by -1
* *
* See #clutter_model_iter_get; this version takes a va_list for language * See clutter_model_iter_get(). This version takes a va_list for language
* bindings. * bindings.
* *
* Since 0.6 * Since: 0.6
*/ */
void void
clutter_model_iter_get_valist (ClutterModelIter *iter, clutter_model_iter_get_valist (ClutterModelIter *iter,
va_list args) va_list args)
{ {
ClutterModel *model;
ClutterModelPrivate *model_priv;
ClutterModelIterPrivate *priv; ClutterModelIterPrivate *priv;
ClutterModel *model;
guint column = 0; guint column = 0;
g_return_if_fail (CLUTTER_IS_MODEL_ITER (iter)); g_return_if_fail (CLUTTER_IS_MODEL_ITER (iter));
priv = iter->priv; priv = iter->priv;
model = priv->model; model = priv->model;
g_assert (CLUTTER_IS_MODEL (model));
g_return_if_fail (CLUTTER_IS_MODEL (model));
model_priv = model->priv;
column = va_arg (args, gint); column = va_arg (args, gint);
while (column != -1) while (column != -1)
@ -1749,7 +1760,7 @@ clutter_model_iter_get_valist (ClutterModelIter *iter,
GValue value = { 0, }; GValue value = { 0, };
gchar *error = NULL; gchar *error = NULL;
if (column < 0 || column >= model_priv->n_columns) if (column < 0 || column >= clutter_model_get_n_columns (model))
{ {
g_warning ("%s: Invalid column number %d added to iter " g_warning ("%s: Invalid column number %d added to iter "
"(remember to end you list of columns with a -1)", "(remember to end you list of columns with a -1)",
@ -1781,15 +1792,19 @@ clutter_model_iter_get_valist (ClutterModelIter *iter,
/** /**
* clutter_model_iter_set: * clutter_model_iter_set:
* @iter: a #ClutterModelIter * @iter: a #ClutterModelIter
* @Varargs: va_list of column/return location pairs, terminiated by -1 * @Varargs: a list of column/return location pairs, terminated by -1
* *
* Sets the value of one or more cells in the row referenced by @iter. The * Sets the value of one or more cells in the row referenced by @iter. The
* variable argument list should contain integer column numbers, each column * variable argument list should contain integer column numbers, each column
* column number followed by the value to be set. The list is terminated by a * column number followed by the value to be set. The list is terminated by a
* -1. For example, to set column 0 with type G_TYPE_STRING, you would write: * -1.
* <literal>clutter_model_iter_set (iter, 0, "foo", -1);</literal>.
* *
* Since 0.6 * For example, to set column 0 with type %G_TYPE_STRING, use:
* <informalexample><programlisting>
* clutter_model_iter_set (iter, 0, "foo", -1);
* </programlisting></informalexample>
*
* Since: 0.6
*/ */
void void
clutter_model_iter_set (ClutterModelIter *iter, clutter_model_iter_set (ClutterModelIter *iter,
@ -1811,10 +1826,10 @@ clutter_model_iter_set (ClutterModelIter *iter,
* @column: column number to retrieve the value from * @column: column number to retrieve the value from
* @value: new value for the cell * @value: new value for the cell
* *
* Sets the data in the cell specified by @iter and @column. The type of @value * Sets the data in the cell specified by @iter and @column. The type of
* must be convertable to the type of the column. * @value must be convertable to the type of the column.
* *
* Since 0.6 * Since: 0.6
*/ */
void void
clutter_model_iter_set_value (ClutterModelIter *iter, clutter_model_iter_set_value (ClutterModelIter *iter,
@ -1839,7 +1854,7 @@ clutter_model_iter_set_value (ClutterModelIter *iter,
* *
* Return value: #TRUE if @iter is the first iter in the filtered model * Return value: #TRUE if @iter is the first iter in the filtered model
* *
* Since 0.6 * Since: 0.6
*/ */
gboolean gboolean
clutter_model_iter_is_first (ClutterModelIter *iter) clutter_model_iter_is_first (ClutterModelIter *iter)
@ -1864,7 +1879,7 @@ clutter_model_iter_is_first (ClutterModelIter *iter)
* *
* Return value: #TRUE if @iter is the last iter in the filtered model. * Return value: #TRUE if @iter is the last iter in the filtered model.
* *
* Since 0.6 * Since: 0.6
*/ */
gboolean gboolean
clutter_model_iter_is_last (ClutterModelIter *iter) clutter_model_iter_is_last (ClutterModelIter *iter)
@ -1884,11 +1899,14 @@ clutter_model_iter_is_last (ClutterModelIter *iter)
* clutter_model_iter_next: * clutter_model_iter_next:
* @iter: a #ClutterModelIter * @iter: a #ClutterModelIter
* *
* Sets the @iter to point at the next position in the model after @iter. * Updates the @iter to point at the next position in the model.
* The model implementation should take into account the presence of
* a filter function.
* *
* Return value: @iter, pointing at the next position. * Return value: The passed iterator, updated to point at the next
* row in the model.
* *
* Since 0.6 * Since: 0.6
*/ */
ClutterModelIter * ClutterModelIter *
clutter_model_iter_next (ClutterModelIter *iter) clutter_model_iter_next (ClutterModelIter *iter)
@ -1908,11 +1926,14 @@ clutter_model_iter_next (ClutterModelIter *iter)
* clutter_model_iter_prev: * clutter_model_iter_prev:
* @iter: a #ClutterModelIter * @iter: a #ClutterModelIter
* *
* Sets the @iter to point at the previous position in the model after @iter. * Sets the @iter to point at the previous position in the model.
* The model implementation should take into account the presence of
* a filter function.
* *
* Return value: @iter, pointing at the previous position. * Return value: The passed iterator, updated to point at the previous
* row in the model.
* *
* Since 0.6 * Since: 0.6
*/ */
ClutterModelIter * ClutterModelIter *
clutter_model_iter_prev (ClutterModelIter *iter) clutter_model_iter_prev (ClutterModelIter *iter)
@ -1932,11 +1953,11 @@ clutter_model_iter_prev (ClutterModelIter *iter)
* clutter_model_iter_get_model: * clutter_model_iter_get_model:
* @iter: a #ClutterModelIter * @iter: a #ClutterModelIter
* *
* Returns a pointer to the #ClutterModel that this iter is part of. * Retrieves a pointer to the #ClutterModel that this iter is part of.
* *
* Return value: a pointer to a #ClutterModel. * Return value: a pointer to a #ClutterModel.
* *
* Since 0.6 * Since: 0.6
*/ */
ClutterModel * ClutterModel *
clutter_model_iter_get_model (ClutterModelIter *iter) clutter_model_iter_get_model (ClutterModelIter *iter)
@ -1956,11 +1977,11 @@ clutter_model_iter_get_model (ClutterModelIter *iter)
* clutter_model_iter_get_row: * clutter_model_iter_get_row:
* @iter: a #ClutterModelIter * @iter: a #ClutterModelIter
* *
* Returns the position of the row that the @iter points to. * Retrieves the position of the row that the @iter points to.
* *
* Return value: the position of the @iter in the model. * Return value: the position of the @iter in the model
* *
* Since 0.6 * Since: 0.6
*/ */
guint guint
clutter_model_iter_get_row (ClutterModelIter *iter) clutter_model_iter_get_row (ClutterModelIter *iter)

View File

@ -344,9 +344,6 @@ void clutter_model_iter_set_value (ClutterModelIter *iter,
gboolean clutter_model_iter_is_first (ClutterModelIter *iter); gboolean clutter_model_iter_is_first (ClutterModelIter *iter);
gboolean clutter_model_iter_is_last (ClutterModelIter *iter); gboolean clutter_model_iter_is_last (ClutterModelIter *iter);
gboolean clutter_model_iter_has_next (ClutterModelIter *iter);
gboolean clutter_model_iter_has_prev (ClutterModelIter *iter);
ClutterModelIter *clutter_model_iter_next (ClutterModelIter *iter); ClutterModelIter *clutter_model_iter_next (ClutterModelIter *iter);
ClutterModelIter *clutter_model_iter_prev (ClutterModelIter *iter); ClutterModelIter *clutter_model_iter_prev (ClutterModelIter *iter);

View File

@ -1,3 +1,7 @@
2007-12-15 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-sections.txt: Added all the unused symbols.
2007-12-14 Emmanuele Bassi <ebassi@openedhand.com> 2007-12-14 Emmanuele Bassi <ebassi@openedhand.com>
* Makefile.am: * Makefile.am:

View File

@ -350,6 +350,7 @@ clutter_actor_set_scale
clutter_actor_get_scale clutter_actor_get_scale
clutter_actor_get_abs_size clutter_actor_get_abs_size
clutter_actor_apply_transform_to_point clutter_actor_apply_transform_to_point
clutter_actor_transform_stage_point
<SUBSECTION> <SUBSECTION>
ClutterVertex ClutterVertex
@ -363,6 +364,8 @@ clutter_actor_set_anchor_point_from_gravity
<SUBSECTION> <SUBSECTION>
clutter_actor_set_reactive clutter_actor_set_reactive
clutter_actor_get_reactive clutter_actor_get_reactive
clutter_actor_apply_shader
clutter_actor_set_shader_param
<SUBSECTION> <SUBSECTION>
clutter_actor_set_depthu clutter_actor_set_depthu
@ -376,7 +379,9 @@ clutter_actor_get_xu
clutter_actor_set_yu clutter_actor_set_yu
clutter_actor_get_yu clutter_actor_get_yu
clutter_actor_set_positionu clutter_actor_set_positionu
clutter_actor_get_positionu
clutter_actor_set_sizeu clutter_actor_set_sizeu
clutter_actor_get_sizeu
clutter_actor_set_anchor_pointu clutter_actor_set_anchor_pointu
clutter_actor_get_anchor_pointu clutter_actor_get_anchor_pointu
@ -1140,11 +1145,14 @@ clutter_scriptable_get_type
<TITLE>ClutterModel</TITLE> <TITLE>ClutterModel</TITLE>
ClutterModel ClutterModel
ClutterModelClass ClutterModelClass
ClutterModelFilterFunc
ClutterModelSortFunc
ClutterModelForeachFunc
clutter_model_set_names clutter_model_set_names
clutter_model_set_types clutter_model_set_types
clutter_model_get_column_name
clutter_model_get_column_type
clutter_model_get_n_columns
clutter_model_get_n_rows
<SUBSECTION>
clutter_model_append clutter_model_append
clutter_model_append_value clutter_model_append_value
clutter_model_prepend clutter_model_prepend
@ -1152,18 +1160,25 @@ clutter_model_prepend_value
clutter_model_insert clutter_model_insert
clutter_model_insert_value clutter_model_insert_value
clutter_model_remove clutter_model_remove
clutter_model_get_column_name
clutter_model_get_column_type <SUBSECTION>
clutter_model_get_n_columns ClutterModelForeachFunc
clutter_model_get_n_rows clutter_model_foreach
clutter_model_set_sorting_column
clutter_model_get_sorting_column
ClutterModelSortFunc
clutter_model_set_sort
clutter_model_resort
ClutterModelFilterFunc
clutter_model_set_filter
clutter_model_filter_iter
clutter_model_filter_row
<SUBSECTION>
clutter_model_get_first_iter clutter_model_get_first_iter
clutter_model_get_last_iter clutter_model_get_last_iter
clutter_model_get_iter_at_row clutter_model_get_iter_at_row
clutter_model_set_sorting_column
clutter_model_get_sorting_column
clutter_model_foreach
clutter_model_set_sort
clutter_model_set_filter
<SUBSECTION Standard> <SUBSECTION Standard>
CLUTTER_TYPE_MODEL CLUTTER_TYPE_MODEL
CLUTTER_MODEL CLUTTER_MODEL
@ -1187,12 +1202,17 @@ clutter_model_iter_get_value
clutter_model_iter_set clutter_model_iter_set
clutter_model_iter_set_valist clutter_model_iter_set_valist
clutter_model_iter_set_value clutter_model_iter_set_value
<SUBSECTION>
clutter_model_iter_is_first clutter_model_iter_is_first
clutter_model_iter_is_last clutter_model_iter_is_last
clutter_model_iter_next clutter_model_iter_next
clutter_model_iter_prev clutter_model_iter_prev
<SUBSECTION>
clutter_model_iter_get_model clutter_model_iter_get_model
clutter_model_iter_get_row clutter_model_iter_get_row
<SUBSECTION Standard> <SUBSECTION Standard>
CLUTTER_TYPE_MODEL_ITER CLUTTER_TYPE_MODEL_ITER
CLUTTER_MODEL_ITER CLUTTER_MODEL_ITER
@ -1260,3 +1280,36 @@ CLUTTER_TYPE_SCORE
ClutterScorePrivate ClutterScorePrivate
clutter_score_get_type clutter_score_get_type
</SECTION> </SECTION>
<SECTION>
<FILE>clutter-shader</FILE>
<TITLE>ClutterShader</TITLE>
ClutterShaderError
ClutterShader
ClutterShaderClass
clutter_shader_new
clutter_shader_set_vertex_source
clutter_shader_get_vertex_source
clutter_shader_set_fragment_source
clutter_shader_get_fragment_source
clutter_shader_bind
clutter_shader_release
clutter_shader_is_bound
clutter_shader_set_is_enabled
clutter_shader_get_is_enabled
clutter_shader_set_uniform_1f
<SUBSECTION Standard>
CLUTTER_IS_SHADER
CLUTTER_IS_SHADER_CLASS
CLUTTER_SHADER
CLUTTER_SHADER_CLASS
CLUTTER_SHADER_ERROR
CLUTTER_SHADER_GET_CLASS
CLUTTER_TYPE_SHADER
<SUBSECTION Private>
ClutterShaderPrivate
clutter_shader_get_type
clutter_shader_error_quark
clutter_shader_release_all
</SECTION>

View File

@ -82,7 +82,7 @@ filter_model (ClutterModel *model)
{ {
ClutterModelIter *iter; ClutterModelIter *iter;
g_print ("* Filter function: even rows\n"); g_print ("\n* Filter function: even rows\n");
clutter_model_set_filter (model, filter_func, NULL, NULL); clutter_model_set_filter (model, filter_func, NULL, NULL);
iter = clutter_model_get_first_iter (model); iter = clutter_model_get_first_iter (model);
@ -94,7 +94,7 @@ filter_model (ClutterModel *model)
} }
g_object_unref (iter); g_object_unref (iter);
g_print ("* Sorting function: reverse alpha\n"); g_print ("\n* Sorting function: reverse alpha\n");
clutter_model_set_sort (model, COLUMN_BAR, sort_func, NULL, NULL); clutter_model_set_sort (model, COLUMN_BAR, sort_func, NULL, NULL);
g_signal_connect (model, "row-changed", G_CALLBACK (on_row_changed), NULL); g_signal_connect (model, "row-changed", G_CALLBACK (on_row_changed), NULL);
@ -107,7 +107,7 @@ filter_model (ClutterModel *model)
clutter_model_foreach (model, foreach_func, NULL); clutter_model_foreach (model, foreach_func, NULL);
g_print ("* Unset filter\n"); g_print ("\n* Unset filter\n");
clutter_model_set_filter (model, NULL, NULL, NULL); clutter_model_set_filter (model, NULL, NULL, NULL);
while (clutter_model_get_n_rows (model)) while (clutter_model_get_n_rows (model))
@ -195,14 +195,14 @@ on_row_removed (ClutterModel *model,
static void static void
on_sort_changed (ClutterModel *model) on_sort_changed (ClutterModel *model)
{ {
g_print ("\n*** Sort Changed ***\n\n"); g_print ("*** Sort Changed ***\n\n");
clutter_model_foreach (model, foreach_func, NULL); clutter_model_foreach (model, foreach_func, NULL);
} }
static void static void
on_filter_changed (ClutterModel *model) on_filter_changed (ClutterModel *model)
{ {
g_print ("\n*** Filter Changed ***\n\n"); g_print ("*** Filter Changed ***\n\n");
} }
int int