diff --git a/doc/cookbook/examples/textures-split-go.c b/doc/cookbook/examples/textures-split-go.c
index 540bc7d0d..11cfd1493 100644
--- a/doc/cookbook/examples/textures-split-go.c
+++ b/doc/cookbook/examples/textures-split-go.c
@@ -35,7 +35,7 @@ go_away (gpointer data)
"y", +context->image_height,
"rotation-angle-z", 2000.,
NULL);
- return FALSE; /* remove the timeout source */
+ return G_SOURCE_REMOVE; /* remove the timeout source */
}
/* We split the four sub-textures faking to be the big texture, moving them
@@ -68,9 +68,9 @@ split (gpointer data)
NULL);
/* In 500ms the textures will flee! */
- g_timeout_add (500, go_away, context);
+ clutter_threads_add_timeout (500, go_away, context);
- return FALSE; /* remove the timeout source */
+ return G_SOURCE_REMOVE; /* remove the timeout source */
}
static ClutterActor *
@@ -178,7 +178,7 @@ main (int argc,
context.image_height = image_height;
/* In two seconds, we'll split the texture! */
- g_timeout_add_seconds (2, split, &context);
+ clutter_threads_add_timeout (2000, split, &context);
clutter_main ();
diff --git a/doc/reference/clutter/clutter-animation-tutorial.xml b/doc/reference/clutter/clutter-animation-tutorial.xml
index 7340dc49d..c5537778e 100644
--- a/doc/reference/clutter/clutter-animation-tutorial.xml
+++ b/doc/reference/clutter/clutter-animation-tutorial.xml
@@ -32,9 +32,9 @@
Basic Animations
The most basic way to create animations with Clutter is via the use
- of g_timeout_add(). This enables a callback function to be called at a
- defined interval. The callback function can then modify actors visual
- properties as to produce an animation.
+ of clutter_threads_add_timeout(). This enables a callback function to be
+ called at a defined interval. The callback function can then modify actors
+ visual properties as to produce an animation.
Simple timeout example
@@ -57,10 +57,11 @@ rotate_actor (gpointer data)
/* add one degree */
clos->current_angle += 1.0
+ /* if we reached the target angle, stop */
if (clos->current_angle == clos->final_angle)
- return FALSE;
+ return G_SOURCE_REMOVE;
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
static void
@@ -80,27 +81,28 @@ rotate_actor_cleanup (gpointer data)
clos->final_angle = 360.0;
clos->current_angle = 0;
- g_timeout_add_full (1000 / 360, /* 360 updates in one second */
- rotate_actor,
- clos,
- rotate_actor_cleanup);
+ clutter_threads_add_timeout_full (G_PRIORITY_DEFAULT,
+ 1000 / 360, /* 360 updates in one second */
+ rotate_actor,
+ clos,
+ rotate_actor_cleanup);
Priorities
%G_PRIORITY_DEFAULT should always be used as the timeouts priority
- (in case of g_timeout_add_full()) as not to intefere with Clutter's
- scheduling of repaints and input event handling.
+ (in case of clutter_threads_add_timeout_full()) as not to intefere with
+ Clutter's scheduling of repaints and input event handling.
Timelines
- Using g_timeout_add() to control an animation is complicated
- and does not work in concert with the rest of the operations Clutter
- must perform for each redraw cycle.
+ Using clutter_threads_add_timeout() to control an animation is
+ complicated and does not work in concert with the rest of the operations
+ Clutter must perform for each redraw cycle.
For this reason, Clutter provides #ClutterTimeline, a class that
allows scheduling animations with a definite duration. Timelines are
@@ -113,7 +115,7 @@ rotate_actor_cleanup (gpointer data)
A Timeline is created with:
-clutter_timeline_new (duration_in_milliseconds);
+ClutterTimeline *timeline = clutter_timeline_new (duration_in_milliseconds);
The duration of the timeline then be modifed via the
@@ -161,7 +163,7 @@ on_new_frame (ClutterTimeline *timeline,
Using a Timeline to drive an animation
Rewrite the example above with a #ClutterTimeline instead of
- using g_timeout_add()
+ using clutter_threads_add_timeout()
#include <clutter/clutter.h>
@@ -189,12 +191,9 @@ on_new_frame (ClutterTimeline *timeline,
clutter_timeline_start (timeline);
-
- Multiple timelines can be sequenced in order by using a
- #ClutterScore. See the #ClutterScore documentation for more details on
- using this.
+