From c444447cd3712153127f4fdd2ac03262ec7689d2 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 17 Dec 2010 12:04:11 +0000 Subject: [PATCH] timeline: Rename the reverse property to auto-reverse Other frameworks expose the same functionality as "auto-reverse", probably to match the cassette tape player. It actually makes sense for Clutter to follow suit. --- clutter/clutter-timeline.c | 57 +++++++++---------- clutter/clutter-timeline.h | 4 +- doc/cookbook/animations.xml | 4 +- .../examples/animations-looping-implicit.c | 2 +- doc/reference/clutter/clutter-sections.txt | 4 +- .../clutter/migrating-ClutterBehaviour.xml | 2 +- tests/interactive/test-behave.c | 2 +- tests/interactive/test-layout.c | 2 +- tests/interactive/test-threads.c | 1 + 9 files changed, 39 insertions(+), 39 deletions(-) diff --git a/clutter/clutter-timeline.c b/clutter/clutter-timeline.c index a06b114f9..e240cf24f 100644 --- a/clutter/clutter-timeline.c +++ b/clutter/clutter-timeline.c @@ -73,7 +73,7 @@ struct _ClutterTimelinePrivate * a tick from the master clock */ guint waiting_first_tick : 1; - guint reverse : 1; + guint auto_reverse : 1; }; typedef struct { @@ -90,7 +90,7 @@ enum PROP_DELAY, PROP_DURATION, PROP_DIRECTION, - PROP_REVERSE, + PROP_AUTO_REVERSE, PROP_LAST }; @@ -163,8 +163,8 @@ clutter_timeline_set_property (GObject *object, clutter_timeline_set_direction (timeline, g_value_get_enum (value)); break; - case PROP_REVERSE: - clutter_timeline_set_reverse (timeline, g_value_get_boolean (value)); + case PROP_AUTO_REVERSE: + clutter_timeline_set_auto_reverse (timeline, g_value_get_boolean (value)); break; default: @@ -200,8 +200,8 @@ clutter_timeline_get_property (GObject *object, g_value_set_enum (value, priv->direction); break; - case PROP_REVERSE: - g_value_set_boolean (value, priv->reverse); + case PROP_AUTO_REVERSE: + g_value_set_boolean (value, priv->auto_reverse); break; default: @@ -314,17 +314,17 @@ clutter_timeline_class_init (ClutterTimelineClass *klass) CLUTTER_PARAM_READWRITE); /** - * ClutterTimeline:reverse: + * ClutterTimeline:auto-reverse: * - * Whether the direction of a looping timeline should be reversed - * when emitting the #ClutterTimeline::completed signal. + * If the direction of the timeline should be automatically reversed + * when reaching the end. * * Since: 1.6 */ - obj_props[PROP_REVERSE] = - g_param_spec_boolean ("reverse", - P_("Reverse"), - P_("Whether the direction should be reversed when looping"), + obj_props[PROP_AUTO_REVERSE] = + g_param_spec_boolean ("auto-reverse", + P_("Auto Reverse"), + P_("Whether the direction should be reversed when reaching the end"), FALSE, CLUTTER_PARAM_READWRITE); @@ -683,11 +683,9 @@ clutter_timeline_do_frame (ClutterTimeline *timeline) g_signal_emit (timeline, timeline_signals[COMPLETED], 0); - /* reverse the direction of the timeline if :loop and - * :reverse are set to TRUE - */ - if (priv->reverse) + if (priv->auto_reverse) { + /* :auto-reverse changes the direction of the timeline */ if (priv->direction == CLUTTER_TIMELINE_FORWARD) priv->direction = CLUTTER_TIMELINE_BACKWARD; else @@ -1538,7 +1536,7 @@ clutter_timeline_has_marker (ClutterTimeline *timeline, } /** - * clutter_timeline_set_reverse: + * clutter_timeline_set_auto_reverse: * @timeline: a #ClutterTimeline * @reverse: %TRUE if the @timeline should reverse the direction * @@ -1576,14 +1574,14 @@ clutter_timeline_has_marker (ClutterTimeline *timeline, * |[ * timeline = clutter_timeline_new (1000); * clutter_timeline_set_loop (timeline); - * clutter_timeline_set_reverse (timeline); + * clutter_timeline_set_auto_reverse (timeline); * ]| * * Since: 1.6 */ void -clutter_timeline_set_reverse (ClutterTimeline *timeline, - gboolean reverse) +clutter_timeline_set_auto_reverse (ClutterTimeline *timeline, + gboolean reverse) { ClutterTimelinePrivate *priv; @@ -1593,29 +1591,30 @@ clutter_timeline_set_reverse (ClutterTimeline *timeline, priv = timeline->priv; - if (priv->reverse != reverse) + if (priv->auto_reverse != reverse) { - priv->reverse = reverse; + priv->auto_reverse = reverse; - _clutter_notify_by_pspec (G_OBJECT (timeline), obj_props[PROP_REVERSE]); + _clutter_notify_by_pspec (G_OBJECT (timeline), + obj_props[PROP_AUTO_REVERSE]); } } /** - * clutter_timeline_get_reverse: + * clutter_timeline_get_auto_reverse: * @timeline: a #ClutterTimeline * - * Retrieves the value set by clutter_timeline_set_reverse(). + * Retrieves the value set by clutter_timeline_set_auto_reverse(). * - * Return value: %TRUE if the timeline should reverse when looping, and + * Return value: %TRUE if the timeline should automatically reverse, and * %FALSE otherwise * * Since: 1.6 */ gboolean -clutter_timeline_get_reverse (ClutterTimeline *timeline) +clutter_timeline_get_auto_reverse (ClutterTimeline *timeline) { g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), FALSE); - return timeline->priv->reverse; + return timeline->priv->auto_reverse; } diff --git a/clutter/clutter-timeline.h b/clutter/clutter-timeline.h index a5f5feb14..4cb2fa4a8 100644 --- a/clutter/clutter-timeline.h +++ b/clutter/clutter-timeline.h @@ -127,9 +127,9 @@ void clutter_timeline_stop (ClutterTimeline *timeli void clutter_timeline_set_loop (ClutterTimeline *timeline, gboolean loop); gboolean clutter_timeline_get_loop (ClutterTimeline *timeline); -void clutter_timeline_set_reverse (ClutterTimeline *timeline, +void clutter_timeline_set_auto_reverse (ClutterTimeline *timeline, gboolean reverse); -gboolean clutter_timeline_get_reverse (ClutterTimeline *timeline); +gboolean clutter_timeline_get_auto_reverse (ClutterTimeline *timeline); void clutter_timeline_rewind (ClutterTimeline *timeline); void clutter_timeline_skip (ClutterTimeline *timeline, guint msecs); diff --git a/doc/cookbook/animations.xml b/doc/cookbook/animations.xml index 628a57f35..dfdcf4385 100644 --- a/doc/cookbook/animations.xml +++ b/doc/cookbook/animations.xml @@ -2660,12 +2660,12 @@ timeline_completed_cb (ClutterTimeline *timeline, completes, the timeline sets itself to run forward again, etc. To make a timeline reverse its direction each time it - completes, use the clutter_timeline_set_reverse() + completes, use the clutter_timeline_set_auto_reverse() function: -clutter_timeline_set_reverse (timeline, TRUE); +clutter_timeline_set_auto_reverse (timeline, TRUE); diff --git a/doc/cookbook/examples/animations-looping-implicit.c b/doc/cookbook/examples/animations-looping-implicit.c index 98bc58818..6606ee185 100644 --- a/doc/cookbook/examples/animations-looping-implicit.c +++ b/doc/cookbook/examples/animations-looping-implicit.c @@ -49,7 +49,7 @@ main (int argc, state->timeline = clutter_timeline_new (1000); clutter_timeline_set_loop (state->timeline, TRUE); - clutter_timeline_set_reverse (state->timeline, TRUE); + clutter_timeline_set_auto_reverse (state->timeline, TRUE); g_signal_connect (stage, "key-press-event", diff --git a/doc/reference/clutter/clutter-sections.txt b/doc/reference/clutter/clutter-sections.txt index 1fb80b08e..037b86c0c 100644 --- a/doc/reference/clutter/clutter-sections.txt +++ b/doc/reference/clutter/clutter-sections.txt @@ -660,8 +660,8 @@ clutter_timeline_get_delay ClutterTimelineDirection clutter_timeline_set_direction clutter_timeline_get_direction -clutter_timeline_set_reverse -clutter_timeline_get_reverse +clutter_timeline_set_auto_reverse +clutter_timeline_get_auto_reverse clutter_timeline_start diff --git a/doc/reference/clutter/migrating-ClutterBehaviour.xml b/doc/reference/clutter/migrating-ClutterBehaviour.xml index 7b2eb7c6b..64ad28076 100644 --- a/doc/reference/clutter/migrating-ClutterBehaviour.xml +++ b/doc/reference/clutter/migrating-ClutterBehaviour.xml @@ -106,7 +106,7 @@ reverse_timeline (ClutterTimeline *timeline) ClutterTimeline *timeline = clutter_animation_get_timeline (animation); clutter_timeline_set_loop (timeline, TRUE); - clutter_timeline_set_reverse (timeline, TRUE); + clutter_timeline_set_auto_reverse (timeline, TRUE); diff --git a/tests/interactive/test-behave.c b/tests/interactive/test-behave.c index 9039cba96..a37cd5b6e 100644 --- a/tests/interactive/test-behave.c +++ b/tests/interactive/test-behave.c @@ -148,7 +148,7 @@ test_behave_main (int argc, char *argv[]) /* Make a timeline */ timeline = clutter_timeline_new (4000); clutter_timeline_set_loop (timeline, TRUE); - clutter_timeline_set_reverse (timeline, TRUE); + clutter_timeline_set_auto_reverse (timeline, TRUE); /* Set an alpha func to power behaviour - ramp is constant rise */ alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR); diff --git a/tests/interactive/test-layout.c b/tests/interactive/test-layout.c index 9d83f5df0..d941cf32a 100644 --- a/tests/interactive/test-layout.c +++ b/tests/interactive/test-layout.c @@ -755,7 +755,7 @@ test_layout_main (int argc, char *argv[]) main_timeline = clutter_timeline_new (2000); clutter_timeline_set_loop (main_timeline, TRUE); - clutter_timeline_set_reverse (main_timeline, TRUE); + clutter_timeline_set_auto_reverse (main_timeline, TRUE); g_signal_connect (main_timeline, "new-frame", G_CALLBACK (relayout_on_frame), NULL); diff --git a/tests/interactive/test-threads.c b/tests/interactive/test-threads.c index 33b7de7bb..18175bb3e 100644 --- a/tests/interactive/test-threads.c +++ b/tests/interactive/test-threads.c @@ -221,6 +221,7 @@ test_threads_main (int argc, char *argv[]) timeline = clutter_timeline_new (3000); clutter_timeline_set_loop (timeline, TRUE); + clutter_timeline_set_auto_reverse (timeline, TRUE); alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR); r_behaviour = clutter_behaviour_rotate_new (alpha,