Remove AnimationMode from the Animation API

The animation mode symbolic id might come from the AnimationMode
enumeration or from the clutter_alpha_register_*() family of
functions. For this reason, we should use a gulong instead of
ClutterAnimationMode whenever we have an "animation mode" parameter
or property.
This commit is contained in:
Emmanuele Bassi 2009-01-16 14:01:46 +00:00
parent 74213e0ee3
commit d02819949d
2 changed files with 31 additions and 29 deletions

View File

@ -84,7 +84,7 @@ struct _ClutterAnimationPrivate
GHashTable *properties; GHashTable *properties;
ClutterAnimationMode mode; gulong mode;
guint loop : 1; guint loop : 1;
guint duration; guint duration;
@ -172,7 +172,7 @@ clutter_animation_set_property (GObject *gobject,
break; break;
case PROP_MODE: case PROP_MODE:
clutter_animation_set_mode (animation, g_value_get_enum (value)); clutter_animation_set_mode (animation, g_value_get_ulong (value));
break; break;
case PROP_DURATION: case PROP_DURATION:
@ -212,7 +212,7 @@ clutter_animation_get_property (GObject *gobject,
break; break;
case PROP_MODE: case PROP_MODE:
g_value_set_enum (value, priv->mode); g_value_set_ulong (value, priv->mode);
break; break;
case PROP_DURATION: case PROP_DURATION:
@ -281,16 +281,18 @@ clutter_animation_class_init (ClutterAnimationClass *klass)
/** /**
* ClutterAnimation:mode: * ClutterAnimation:mode:
* *
* The animation mode. * The animation mode, either a value from #ClutterAnimationMode
* or a value returned by clutter_alpha_register_func(). The
* default value is %CLUTTER_LINEAR.
* *
* Since: 1.0 * Since: 1.0
*/ */
pspec = g_param_spec_enum ("mode", pspec = g_param_spec_ulong ("mode",
"Mode", "Mode",
"The mode of the animation", "The mode of the animation",
CLUTTER_TYPE_ANIMATION_MODE, 0, G_MAXULONG,
CLUTTER_LINEAR, CLUTTER_LINEAR,
CLUTTER_PARAM_READWRITE); CLUTTER_PARAM_READWRITE);
g_object_class_install_property (gobject_class, PROP_MODE, pspec); g_object_class_install_property (gobject_class, PROP_MODE, pspec);
/** /**
@ -820,15 +822,15 @@ clutter_animation_set_mode_internal (ClutterAnimation *animation,
/** /**
* clutter_animation_set_mode: * clutter_animation_set_mode:
* @animation: a #ClutterAnimation * @animation: a #ClutterAnimation
* @mode: a #ClutterAnimationMode * @mode: an animation mode logical id
* *
* Sets the animation @mode of @animation. * Sets the animation @mode of @animation.
* *
* Since: 1.0 * Since: 1.0
*/ */
void void
clutter_animation_set_mode (ClutterAnimation *animation, clutter_animation_set_mode (ClutterAnimation *animation,
ClutterAnimationMode mode) gulong mode)
{ {
ClutterAnimationPrivate *priv; ClutterAnimationPrivate *priv;
@ -848,11 +850,11 @@ clutter_animation_set_mode (ClutterAnimation *animation,
* *
* Retrieves the animation mode of @animation. * Retrieves the animation mode of @animation.
* *
* Return value: the #ClutterAnimationMode for the animation * Return value: the mode for the animation
* *
* Since: 1.0 * Since: 1.0
*/ */
ClutterAnimationMode gulong
clutter_animation_get_mode (ClutterAnimation *animation) clutter_animation_get_mode (ClutterAnimation *animation)
{ {
g_return_val_if_fail (CLUTTER_IS_ANIMATION (animation), CLUTTER_LINEAR); g_return_val_if_fail (CLUTTER_IS_ANIMATION (animation), CLUTTER_LINEAR);
@ -1301,7 +1303,7 @@ clutter_actor_animate_with_alpha (ClutterActor *actor,
/** /**
* clutter_actor_animate_with_timeline: * clutter_actor_animate_with_timeline:
* @actor: a #ClutterActor * @actor: a #ClutterActor
* @mode: a #ClutterAnimationMode value * @mode: an animation mode logical id
* @timeline: a #ClutterTimeline * @timeline: a #ClutterTimeline
* @first_property_name: the name of a property * @first_property_name: the name of a property
* @VarArgs: a %NULL terminated list of property names and * @VarArgs: a %NULL terminated list of property names and
@ -1322,10 +1324,10 @@ clutter_actor_animate_with_alpha (ClutterActor *actor,
* Since: 1.0 * Since: 1.0
*/ */
ClutterAnimation * ClutterAnimation *
clutter_actor_animate_with_timeline (ClutterActor *actor, clutter_actor_animate_with_timeline (ClutterActor *actor,
ClutterAnimationMode mode, gulong mode,
ClutterTimeline *timeline, ClutterTimeline *timeline,
const gchar *first_property_name, const gchar *first_property_name,
...) ...)
{ {
ClutterAnimation *animation; ClutterAnimation *animation;
@ -1359,7 +1361,7 @@ clutter_actor_animate_with_timeline (ClutterActor *actor,
/** /**
* clutter_actor_animate: * clutter_actor_animate:
* @actor: a #ClutterActor * @actor: a #ClutterActor
* @mode: a #ClutterAnimationMode value * @mode: an animation mode logical id
* @duration: duration of the animation, in milliseconds * @duration: duration of the animation, in milliseconds
* @first_property_name: the name of a property * @first_property_name: the name of a property
* @VarArgs: a %NULL terminated list of property names and * @VarArgs: a %NULL terminated list of property names and
@ -1416,10 +1418,10 @@ clutter_actor_animate_with_timeline (ClutterActor *actor,
* Since: 1.0 * Since: 1.0
*/ */
ClutterAnimation * ClutterAnimation *
clutter_actor_animate (ClutterActor *actor, clutter_actor_animate (ClutterActor *actor,
ClutterAnimationMode mode, gulong mode,
guint duration, guint duration,
const gchar *first_property_name, const gchar *first_property_name,
...) ...)
{ {
ClutterAnimation *animation; ClutterAnimation *animation;

View File

@ -101,8 +101,8 @@ void clutter_animation_set_object (ClutterAnimation *an
GObject *object); GObject *object);
GObject * clutter_animation_get_object (ClutterAnimation *animation); GObject * clutter_animation_get_object (ClutterAnimation *animation);
void clutter_animation_set_mode (ClutterAnimation *animation, void clutter_animation_set_mode (ClutterAnimation *animation,
ClutterAnimationMode mode); gulong mode);
ClutterAnimationMode clutter_animation_get_mode (ClutterAnimation *animation); gulong clutter_animation_get_mode (ClutterAnimation *animation);
void clutter_animation_set_duration (ClutterAnimation *animation, void clutter_animation_set_duration (ClutterAnimation *animation,
gint msecs); gint msecs);
guint clutter_animation_get_duration (ClutterAnimation *animation); guint clutter_animation_get_duration (ClutterAnimation *animation);
@ -130,12 +130,12 @@ ClutterInterval *clutter_animation_get_interval (ClutterAnimation *an
const gchar *property_name); const gchar *property_name);
ClutterAnimation * clutter_actor_animate (ClutterActor *actor, ClutterAnimation * clutter_actor_animate (ClutterActor *actor,
ClutterAnimationMode mode, gulong mode,
guint duration, guint duration,
const gchar *first_property_name, const gchar *first_property_name,
...) G_GNUC_NULL_TERMINATED; ...) G_GNUC_NULL_TERMINATED;
ClutterAnimation * clutter_actor_animate_with_timeline (ClutterActor *actor, ClutterAnimation * clutter_actor_animate_with_timeline (ClutterActor *actor,
ClutterAnimationMode mode, gulong mode,
ClutterTimeline *timeline, ClutterTimeline *timeline,
const gchar *first_property_name, const gchar *first_property_name,
...) G_GNUC_NULL_TERMINATED; ...) G_GNUC_NULL_TERMINATED;