model: Let get_n_columns() return a sane value

If you call get_n_columns() during the instance initialization phase but
before set_name()/set_types() have been called, you'll get a (guint) -1.
This is less than ideal.

If columns haven't been initialized we should just return 0, which was
the intent of the API since the beginning.

Based on a patch by: Bastian Winkler <buz@netbuz.org>

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
This commit is contained in:
Emmanuele Bassi 2010-03-17 17:14:08 +00:00
parent 0a6497a3b6
commit d735ac4807

View File

@ -244,7 +244,12 @@ clutter_model_real_get_column_name (ClutterModel *model,
static guint
clutter_model_real_get_n_columns (ClutterModel *model)
{
return model->priv->n_columns;
ClutterModelPrivate *priv = model->priv;
if (priv->n_columns < 0)
return 0;
return priv->n_columns;
}
static void