From 762053cd28058bc93d4d2d71b1da1a5599042c0a Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 8 Jun 2012 17:32:51 +0100 Subject: [PATCH] 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. --- clutter/clutter-interval.c | 24 ++++++++++++++++++++++++ clutter/clutter-interval.h | 3 +++ clutter/clutter.symbols | 1 + 3 files changed, 28 insertions(+) diff --git a/clutter/clutter-interval.c b/clutter/clutter-interval.c index 15246670f..00db42fb2 100644 --- a/clutter/clutter-interval.c +++ b/clutter/clutter-interval.c @@ -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]); +} diff --git a/clutter/clutter-interval.h b/clutter/clutter-interval.h index a994e2709..b0c371463 100644 --- a/clutter/clutter-interval.h +++ b/clutter/clutter-interval.h @@ -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__ */ diff --git a/clutter/clutter.symbols b/clutter/clutter.symbols index f509e5ed4..65c7e2a75 100644 --- a/clutter/clutter.symbols +++ b/clutter/clutter.symbols @@ -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