interactive: Use the newly added CLUTTER_ALIGN_BOTH value
authorEmmanuele Bassi <ebassi@gnome.org>
Sat, 15 Oct 2011 17:35:45 +0000 (18:35 +0100)
committerEmmanuele Bassi <ebassi@gnome.org>
Sat, 15 Oct 2011 17:36:27 +0000 (18:36 +0100)
We center a lot of stuff using ClutterAlignConstraints.

tests/interactive/test-actors.c
tests/interactive/test-constraints.c
tests/interactive/test-scrolling.c
tests/interactive/test-snap-constraint.c
tests/interactive/test-state-script.c

index f3d7b23..4ce782a 100644 (file)
@@ -216,8 +216,7 @@ test_actors_main (int argc, char *argv[])
   oh->group = clutter_group_new();
   clutter_actor_set_name (oh->group, "Group");
   g_signal_connect (oh->group, "destroy", G_CALLBACK (on_group_destroy), oh);
-  clutter_actor_add_constraint (oh->group, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5));
-  clutter_actor_add_constraint (oh->group, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5));
+  clutter_actor_add_constraint (oh->group, clutter_align_constraint_new (stage, CLUTTER_ALIGN_BOTH, 0.5));
   clutter_actor_add_constraint (oh->group, clutter_bind_constraint_new (stage, CLUTTER_BIND_SIZE, 0.0f));
 
   oh->hand = g_new (ClutterActor*, n_hands);
index 3e45ce9..0c6a54f 100644 (file)
@@ -186,11 +186,8 @@ test_constraints_main (int argc, char *argv[])
   clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
 
   /* align the center rectangle to the center of the stage */
-  constraint = clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5);
-  clutter_actor_add_constraint_with_name (rect, "x-align", constraint);
-
-  constraint = clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5);
-  clutter_actor_add_constraint_with_name (rect, "y-align", constraint);
+  constraint = clutter_align_constraint_new (stage, CLUTTER_ALIGN_BOTH, 0.5);
+  clutter_actor_add_constraint_with_name (rect, "align", constraint);
 
   /* this is the equivalent of the DesaturateEffect; we cannot animate
    * the factor because the animation API only understands GObject
index 73ba63a..9699d55 100644 (file)
@@ -88,8 +88,7 @@ test_scrolling_main (int argc, char *argv[])
   scroll = clutter_group_new ();
   clutter_container_add_actor (CLUTTER_CONTAINER (stage), scroll);
   clutter_actor_set_size (scroll, RECT_WIDTH, RECT_HEIGHT);
-  clutter_actor_add_constraint (scroll, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5));
-  clutter_actor_add_constraint (scroll, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5));
+  clutter_actor_add_constraint (scroll, clutter_align_constraint_new (stage, CLUTTER_ALIGN_BOTH, 0.5));
   clutter_actor_set_clip_to_allocation (scroll, TRUE);
 
   /* viewport: the actual container for the children; we scroll it using
index 6ca4e33..e36350c 100644 (file)
@@ -27,8 +27,7 @@ test_snap_constraint_main (int   argc,
   clutter_actor_set_size (layer_a, 100.0, 25.0);
 
   /* the first layer is anchored to the middle of the stage */
-  clutter_actor_add_constraint (layer_a, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5));
-  clutter_actor_add_constraint (layer_a, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5));
+  clutter_actor_add_constraint (layer_a, clutter_align_constraint_new (stage, CLUTTER_ALIGN_BOTH, 0.5));
 
   /* second layer, with no implicit size */
   layer_b = clutter_rectangle_new_with_color (CLUTTER_COLOR_DarkButter);
index 276cd85..e777d89 100644 (file)
@@ -41,8 +41,7 @@ test_state_script_main (int argc, char *argv[])
 
   button = CLUTTER_ACTOR (clutter_script_get_object (script, "button"));
   clutter_container_add_actor (CLUTTER_CONTAINER (stage), button);
-  clutter_actor_add_constraint (button, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5));
-  clutter_actor_add_constraint (button, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5));
+  clutter_actor_add_constraint (button, clutter_align_constraint_new (stage, CLUTTER_ALIGN_BOTH, 0.5));
 
   clutter_script_connect_signals (script, NULL);