doc: fix clutter_init() usage in examples

Make sure users get the idea that clutter_init()
has a return value that needs to be checked.

These were fixed via sed magic:

sed -i -s -e "s/clutter_init (.*)/\
if (& != CLUTTER_INIT_SUCCESS)\n    return 1/"\
 doc/*/*/*.{c,xml} doc/*/*.xml

http://bugzilla.clutter-project.org/show_bug.cgi?id=2574
This commit is contained in:
nobled 2011-02-22 00:44:55 +00:00 committed by Neil Roberts
parent eb906d85ca
commit aece642adb
44 changed files with 98 additions and 52 deletions

View File

@ -32,7 +32,8 @@ main (int argc,
ClutterConstraint *align_x_constraint;
ClutterConstraint *align_y_constraint;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_new ();
clutter_actor_set_size (stage, 400, 400);

View File

@ -40,7 +40,8 @@ main (int argc, char *argv[])
if (argc > 1)
filename = argv[1];
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
script = clutter_script_new ();
clutter_script_load_from_file (script, filename, &error);

View File

@ -26,7 +26,8 @@ main (int argc,
ClutterTimeline *timeline;
ClutterAnimator *animator;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
clutter_actor_set_size (stage, 300, 200);

View File

@ -36,7 +36,8 @@ main (int argc,
ClutterActor *stage;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
clutter_actor_set_size (stage, 300, 200);

View File

@ -37,7 +37,8 @@ main (int argc,
ClutterActor *actor;
ClutterState *transitions;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
clutter_actor_set_size (stage, 300, 200);

View File

@ -73,7 +73,8 @@ main (int argc,
/* seed random number generator */
srand ((unsigned int) time (NULL));
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
state->animator = clutter_animator_new ();
clutter_animator_set_duration (state->animator, 500);

View File

@ -44,7 +44,8 @@ main (int argc,
AnimationSpec y_move = { "y", 400.0 };
AnimationSpec z_move = { "depth", -1000.0 };
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
clutter_actor_set_size (stage, 500, 500);

View File

@ -27,7 +27,8 @@ main (int argc,
ClutterActor *green;
ClutterState *transitions;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
clutter_actor_set_size (stage, 650, 500);

View File

@ -70,7 +70,8 @@ main (int argc,
ClutterActor *stage;
ClutterActor *rectangle;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_new ();
clutter_actor_set_size (stage, STAGE_SIDE, STAGE_SIDE);

View File

@ -49,7 +49,8 @@ main (int argc,
ClutterActor *stage;
ClutterAnimator *animator;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_new ();
clutter_actor_set_size (stage, 400, 400);

View File

@ -14,7 +14,8 @@ main (int argc,
const ClutterColor *stage_color = clutter_color_new (51, 51, 85, 255);
const ClutterColor *red_color = clutter_color_new (255, 0, 0, 255);
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_new ();
clutter_actor_set_size (stage, 360, 300);

View File

@ -82,7 +82,8 @@ main (int argc, char *argv[])
ClutterScript *script;
ClutterActor *stage;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
script = clutter_script_new ();
load_script_from_file (script, UI_FILE);

View File

@ -39,7 +39,8 @@ main (int argc, char *argv[])
GError *error = NULL;
gfloat texture_width, texture_height;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

View File

@ -106,7 +106,8 @@ main (int argc,
image_path = argv[1];
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
clutter_actor_set_size (stage, STAGE_SIDE, STAGE_SIDE);

View File

@ -114,7 +114,8 @@ main (int argc,
State *state = g_new0 (State, 1);
ClutterActor *stage;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
clutter_actor_set_size (stage, 350, 350);

View File

@ -20,7 +20,8 @@ main (int argc,
filename = argv[1];
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_new ();
clutter_actor_set_size (stage, 400, 400);

View File

@ -46,7 +46,8 @@ main (int argc,
filename = argv[1];
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_new ();
clutter_actor_set_size (stage, 400, 300);

View File

@ -23,7 +23,8 @@ main (int argc,
ClutterActor *actor1;
ClutterActor *actor2;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
clutter_actor_set_size (stage, 400, 400);

View File

@ -122,7 +122,8 @@ main (int argc,
/* seed random number generator */
srand ((unsigned int) time (NULL));
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
clutter_actor_set_size (stage, 320, 240);

View File

@ -57,7 +57,8 @@ main (int argc,
ClutterActor *red;
ClutterActor *green;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
clutter_actor_set_size (stage, 400, 400);

View File

@ -75,7 +75,8 @@ main (int argc, char *argv[])
image_file_path = argv[1];
}
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);

View File

@ -34,7 +34,8 @@ main (int argc, char *argv[])
ClutterActor *text;
ClutterState *transitions;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);

View File

@ -107,7 +107,8 @@ main (int argc, char *argv[])
ClutterActor *rect;
ClutterActor *canvas;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
context->path = clutter_path_new ();

View File

@ -50,7 +50,8 @@ main (int argc, char *argv[])
ClutterActor *stage;
ClutterActor *r1, *r2, *r3;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
clutter_actor_set_size (stage, 300, 300);

View File

@ -29,7 +29,8 @@ main (int argc, char *argv[])
ClutterActor *stage;
ClutterActor *rectangle;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
clutter_actor_set_size (stage, 400, 400);

View File

@ -35,7 +35,8 @@ main (int argc, char *argv[])
ClutterActor *actor;
ClutterActor *overlay;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
clutter_actor_set_size (stage, 400, 400);

View File

@ -78,7 +78,8 @@ main (int argc, char *argv[])
if (argc > 1)
filename = argv[1];
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_new ();
clutter_actor_set_size (stage, STAGE_SIDE, STAGE_SIDE);

View File

@ -16,7 +16,8 @@ main (int argc, char *argv[])
ClutterConstraint *width_binding;
ClutterConstraint *height_binding;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_new ();
clutter_actor_set_size (stage, 400, 400);

View File

@ -88,7 +88,8 @@ main (int argc,
ClutterLayoutManager *menu_layout;
ClutterActor *menu;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
clutter_actor_set_size (stage, 400, 400);

View File

@ -314,7 +314,8 @@ main (int argc,
State *state = g_new0 (State, 1);
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
state->x_fill = FALSE;
state->y_fill = FALSE;

View File

@ -18,7 +18,8 @@ main (int argc,
ClutterActor *red;
ClutterActor *blue;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
clutter_actor_set_size (stage, 400, 400);

View File

@ -14,7 +14,8 @@ main (int argc, char *argv[])
ClutterColor *color;
ClutterActor *rect;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
clutter_actor_set_size (stage, 400, 400);

View File

@ -25,7 +25,8 @@ main (int argc, char *argv[])
if (argc > 1)
filename = argv[1];
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
clutter_actor_set_size (stage, STAGE_SIDE, STAGE_SIDE);

View File

@ -61,7 +61,8 @@ main (int argc, char *argv[])
gchar *filename = "script-signals.json";
GError *error = NULL;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
ui = clutter_script_new ();

View File

@ -10,7 +10,8 @@ main (int argc, char *argv[])
gchar *filename = "script-ui.json";
GError *error = NULL;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
ui = clutter_script_new ();

View File

@ -40,7 +40,8 @@ main (int argc, char *argv[])
ClutterActor *stage;
ClutterActor *text;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "Text shadow");

View File

@ -106,10 +106,11 @@ main (int argc, char *argv[])
ClutterActor *texture;
ClutterTimeline *timeline;
clutter_init_with_args (&argc, &argv,
" - Crossfade", entries,
NULL,
NULL);
if (clutter_init_with_args (&argc, &argv,
" - Crossfade", entries,
NULL,
NULL) != CLUTTER_INIT_SUCCESS)
return 1;
if (source == NULL || target == NULL)
return print_usage_and_exit (argv[0], EXIT_FAILURE);

View File

@ -122,7 +122,8 @@ main (int argc, char *argv[])
for (i = 1; i < argc; i++)
app->image_paths = g_slist_append (app->image_paths, argv[i]);
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

View File

@ -70,10 +70,11 @@ main (int argc, char *argv[])
ClutterActor *top, *bottom;
ClutterState *transitions;
clutter_init_with_args (&argc, &argv,
" - cross-fade", entries,
NULL,
NULL);
if (clutter_init_with_args (&argc, &argv,
" - cross-fade", entries,
NULL,
NULL) != CLUTTER_INIT_SUCCESS)
return 1;
if (source == NULL || target == NULL)
{
@ -81,7 +82,8 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
}
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "cross-fade");

View File

@ -77,7 +77,8 @@ main (int argc, char *argv[])
ClutterActor *clone;
gfloat y_offset;
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "Reflection");

View File

@ -114,7 +114,8 @@ main (int argc,
CoglHandle texture;
Context context;
clutter_init (NULL, NULL);
if (clutter_init (NULL, NULL) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
clutter_actor_get_size (stage, &stage_width, &stage_height);

View File

@ -8,7 +8,8 @@ main (int argc, char **argv)
gfloat image_width, image_height;
/* Initialize Clutter */
clutter_init (NULL, NULL);
if (clutter_init (NULL, NULL) != CLUTTER_INIT_SUCCESS)
return 1;
/* Get the default stage */
stage = clutter_stage_get_default ();

View File

@ -441,7 +441,8 @@ main (int argc, char *argv[])
/* initialize GLib's default threading implementation */
g_thread_init (NULL);
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
/* ... get stage etc. */
@ -711,7 +712,8 @@ _clone_paint_cb (ClutterActor *actor)
int
main (int argc, char *argv[])
{
clutter_init (&argc, &argv);
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
/* ... get stage etc. */

View File

@ -299,7 +299,8 @@ main (int argc, char *argv[])
ClutterAlpha *alpha;
ClutterActor *stage, *actor;
clutter_init (&amp;argc, &amp;argv);
if (clutter_init (&amp;argc, &amp;argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();