[model] Add a private row mutator to ClutterModelIter

When calling clutter_model_iter_next () / clutter_model_iter_prev () we need
to update the row for the iterator. In order to improve the peformance of
iterating this change adds a private row mutator and switches ClutterListModel
to use it.
This commit is contained in:
Rob Bradford 2009-05-05 20:15:01 +01:00
parent b2fbc2c95c
commit 41bb885486
3 changed files with 15 additions and 2 deletions

View File

@ -333,7 +333,7 @@ clutter_list_model_iter_next (ClutterModelIter *iter)
row += 1; row += 1;
/* update the iterator and return it */ /* update the iterator and return it */
g_object_set (G_OBJECT (iter_default), "model", model, "row", row, NULL); clutter_model_iter_set_row (CLUTTER_MODEL_ITER (iter_default), row);
iter_default->seq_iter = filter_next; iter_default->seq_iter = filter_next;
return CLUTTER_MODEL_ITER (iter_default); return CLUTTER_MODEL_ITER (iter_default);
@ -376,7 +376,7 @@ clutter_list_model_iter_prev (ClutterModelIter *iter)
row -= 1; row -= 1;
/* update the iterator and return it */ /* update the iterator and return it */
g_object_set (G_OBJECT (iter_default), "model", model, "row", row, NULL); clutter_model_iter_set_row (CLUTTER_MODEL_ITER (iter_default), row);
iter_default->seq_iter = filter_prev; iter_default->seq_iter = filter_prev;
return CLUTTER_MODEL_ITER (iter_default); return CLUTTER_MODEL_ITER (iter_default);

View File

@ -19,6 +19,9 @@ void clutter_model_set_column_name (ClutterModel *model,
gint column, gint column,
const gchar *name); const gchar *name);
void clutter_model_iter_set_row (ClutterModelIter *iter,
guint row);
G_END_DECLS G_END_DECLS
#endif /* __CLUTTER_MODEL_PRIVATE_H__ */ #endif /* __CLUTTER_MODEL_PRIVATE_H__ */

View File

@ -441,6 +441,8 @@ clutter_model_check_type (GType gtype)
return FALSE; return FALSE;
} }
/** /**
* clutter_model_resort: * clutter_model_resort:
* @model: a #ClutterModel * @model: a #ClutterModel
@ -1509,6 +1511,14 @@ clutter_model_iter_real_get_row (ClutterModelIter *iter)
return iter->priv->row; return iter->priv->row;
} }
/* private function */
void
clutter_model_iter_set_row (ClutterModelIter *iter,
guint row)
{
iter->priv->row = row;
}
static void static void
clutter_model_iter_get_value_unimplemented (ClutterModelIter *iter, clutter_model_iter_get_value_unimplemented (ClutterModelIter *iter,
guint column, guint column,