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.
This commit is contained in:
Emmanuele Bassi 2010-12-17 12:04:11 +00:00
parent 397e0ddb16
commit c444447cd3
9 changed files with 39 additions and 39 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -2660,12 +2660,12 @@ timeline_completed_cb (ClutterTimeline *timeline,
completes, the timeline sets itself to run forward again, etc.</para>
<para>To make a timeline reverse its direction each time it
completes, use the <function>clutter_timeline_set_reverse()</function>
completes, use the <function>clutter_timeline_set_auto_reverse()</function>
function:</para>
<informalexample>
<programlisting>
clutter_timeline_set_reverse (timeline, TRUE);
clutter_timeline_set_auto_reverse (timeline, TRUE);
</programlisting>
</informalexample>

View File

@ -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",

View File

@ -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
<SUBSECTION>
clutter_timeline_start

View File

@ -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);
</programlisting>
</informalexample>

View File

@ -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);

View File

@ -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);

View File

@ -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,