1
0
Fork 0

interactive: Drop more deprecated classes

This commit is contained in:
Emmanuele Bassi 2012-01-17 16:54:30 +00:00
parent 8f1575b970
commit 7dd06de6d5
3 changed files with 23 additions and 21 deletions

View file

@ -175,15 +175,15 @@ test_constraints_main (int argc, char *argv[])
/* main rectangle */
clutter_color_from_string (&rect_color, "#3465a4");
rect = clutter_rectangle_new ();
rect = clutter_actor_new ();
g_signal_connect (rect, "button-release-event",
G_CALLBACK (on_button_release),
NULL);
clutter_rectangle_set_color (CLUTTER_RECTANGLE (rect), &rect_color);
clutter_actor_set_background_color (rect, &rect_color);
clutter_actor_set_size (rect, RECT_SIZE, RECT_SIZE);
clutter_actor_set_reactive (rect, TRUE);
clutter_actor_set_name (rect, names[Center]);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
clutter_actor_add_child (stage, rect);
/* align the center rectangle to the center of the stage */
constraint = clutter_align_constraint_new (stage, CLUTTER_ALIGN_BOTH, 0.5);
@ -216,11 +216,12 @@ test_constraints_main (int argc, char *argv[])
continue;
clutter_color_from_string (&rect_color, colors[i]);
rect = clutter_rectangle_new ();
clutter_rectangle_set_color (CLUTTER_RECTANGLE (rect), &rect_color);
rect = clutter_actor_new ();
clutter_actor_set_background_color (rect, &rect_color);
clutter_actor_set_opacity (rect, 0);
clutter_actor_set_name (rect, names[i]);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect);
clutter_actor_add_child (stage, rect);
constraint = clutter_bind_constraint_new (rects[Center], CLUTTER_BIND_X, 0.0);
clutter_actor_add_constraint_with_name (rect, "x-bind", constraint);

View file

@ -18,8 +18,11 @@ static gboolean raise_no = 0;
static gboolean
raise_top (gpointer ignored)
{
clutter_actor_raise_top (raise_actor[raise_no]);
ClutterActor *parent = clutter_actor_get_parent (raise_actor[raise_no]);
clutter_actor_set_child_above_sibling (parent, raise_actor[raise_no], NULL);
raise_no = !raise_no;
return TRUE;
}
@ -32,7 +35,7 @@ clone_box (ClutterActor *original)
clutter_actor_get_size (original, &width, &height);
group = clutter_group_new ();
group = clutter_actor_new ();
clone = clutter_clone_new (original);
clutter_container_add_actor (CLUTTER_CONTAINER (group), clone);
clutter_actor_set_depth (clone, width / 2);
@ -66,8 +69,6 @@ clone_box (ClutterActor *original)
clutter_actor_set_depth (clone, -width / 2);
clutter_actor_set_position (clone, 0, 0);
clutter_actor_show_all (group);
return group;
}
@ -79,8 +80,9 @@ janus_group (const gchar *front_text,
gfloat width, height;
gfloat width2, height2;
group = clutter_group_new ();
rectangle = clutter_rectangle_new_with_color (CLUTTER_COLOR_White);
group = clutter_actor_new ();
rectangle = clutter_actor_new ();
clutter_actor_set_background_color (rectangle, CLUTTER_COLOR_White);
front = clutter_text_new_with_text ("Sans 50px", front_text);
back = clutter_text_new_with_text ("Sans 50px", back_text);
clutter_text_set_color (CLUTTER_TEXT (front), CLUTTER_COLOR_Red);
@ -101,7 +103,6 @@ janus_group (const gchar *front_text,
clutter_container_add (CLUTTER_CONTAINER (group),
back, rectangle, front, NULL);
clutter_actor_show_all (group);
return group;
}
@ -129,12 +130,11 @@ test_depth_main (int argc, char *argv[])
"button-press-event", G_CALLBACK (clutter_main_quit),
NULL);
group = clutter_group_new ();
group = clutter_actor_new ();
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
label = clutter_text_new_with_text ("Mono 26", "Clutter");
clutter_actor_set_position (label, 120, 200);
clutter_actor_show (label);
error = NULL;
hand = clutter_texture_new_from_file (TESTS_DATADIR
@ -144,13 +144,11 @@ test_depth_main (int argc, char *argv[])
if (error)
g_error ("Unable to load redhand.png: %s", error->message);
clutter_actor_set_position (hand, 240, 100);
clutter_actor_show (hand);
rect = clutter_rectangle_new_with_color (CLUTTER_COLOR_Black);
clutter_actor_set_position (rect, 340, 100);
clutter_actor_set_size (rect, 200, 200);
clutter_actor_set_opacity (rect, 128);
clutter_actor_show (rect);
clutter_container_add (CLUTTER_CONTAINER (group), hand, rect, NULL);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), label);
@ -196,7 +194,6 @@ test_depth_main (int argc, char *argv[])
0, 360);
clutter_behaviour_apply (r_behave, box);
clutter_actor_show (stage);
clutter_timeline_start (timeline);

View file

@ -70,8 +70,8 @@ static ClutterActor *new_rect (gint r,
{
GError *error = NULL;
ClutterColor *color = clutter_color_new (r, g, b, a);
ClutterActor *group = clutter_group_new ();
ClutterActor *rectangle = clutter_rectangle_new_with_color (color);
ClutterActor *group = clutter_actor_new ();
ClutterActor *rectangle = clutter_actor_new ();
ClutterActor *hand = NULL;
gchar *file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
@ -82,9 +82,13 @@ static ClutterActor *new_rect (gint r,
g_free (file);
clutter_actor_set_size (hand, ACTOR_WIDTH,ACTOR_HEIGHT);
clutter_actor_set_background_color (rectangle, color);
clutter_actor_set_size (rectangle, ACTOR_WIDTH,ACTOR_HEIGHT);
clutter_color_free (color);
clutter_container_add (CLUTTER_CONTAINER (group), rectangle, hand, NULL);
clutter_actor_add_child (group, rectangle);
clutter_actor_add_child (group, hand);
return group;
}