interval: Add is_valid() method

The is_valid() method checks if the Interval has an initial and final
values and it's not still uninitialized.
This commit is contained in:
Emmanuele Bassi 2012-06-08 17:32:51 +01:00
parent dfab055443
commit 762053cd28
3 changed files with 28 additions and 0 deletions

View File

@ -1065,3 +1065,27 @@ clutter_interval_compute (ClutterInterval *interval,
return NULL;
}
/**
* clutter_interval_is_valid:
* @interval: a #ClutterInterval
*
* Checks if the @interval has a valid initial and final values.
*
* Return value: %TRUE if the #ClutterInterval has an initial and
* final values, and %FALSE otherwise
*
* Since: 1.12
*/
gboolean
clutter_interval_is_valid (ClutterInterval *interval)
{
ClutterIntervalPrivate *priv;
g_return_val_if_fail (CLUTTER_IS_INTERVAL (interval), FALSE);
priv = interval->priv;
return G_IS_VALUE (&priv->values[INITIAL]) &&
G_IS_VALUE (&priv->values[FINAL]);
}

View File

@ -133,6 +133,9 @@ gboolean clutter_interval_compute_value (ClutterInterval *interval,
const GValue * clutter_interval_compute (ClutterInterval *interval,
gdouble factor);
CLUTTER_AVAILABLE_IN_1_12
gboolean clutter_interval_is_valid (ClutterInterval *interval);
G_END_DECLS
#endif /* __CLUTTER_INTERVAL_H__ */

View File

@ -794,6 +794,7 @@ clutter_interval_get_initial_value
clutter_interval_get_interval
clutter_interval_get_type
clutter_interval_get_value_type
clutter_interval_is_valid
clutter_interval_new
clutter_interval_new_with_values
clutter_interval_peek_final_value