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 */ /* main rectangle */
clutter_color_from_string (&rect_color, "#3465a4"); clutter_color_from_string (&rect_color, "#3465a4");
rect = clutter_rectangle_new (); rect = clutter_actor_new ();
g_signal_connect (rect, "button-release-event", g_signal_connect (rect, "button-release-event",
G_CALLBACK (on_button_release), G_CALLBACK (on_button_release),
NULL); 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_size (rect, RECT_SIZE, RECT_SIZE);
clutter_actor_set_reactive (rect, TRUE); clutter_actor_set_reactive (rect, TRUE);
clutter_actor_set_name (rect, names[Center]); 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 */ /* align the center rectangle to the center of the stage */
constraint = clutter_align_constraint_new (stage, CLUTTER_ALIGN_BOTH, 0.5); constraint = clutter_align_constraint_new (stage, CLUTTER_ALIGN_BOTH, 0.5);
@ -216,11 +216,12 @@ test_constraints_main (int argc, char *argv[])
continue; continue;
clutter_color_from_string (&rect_color, colors[i]); 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_opacity (rect, 0);
clutter_actor_set_name (rect, names[i]); 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); constraint = clutter_bind_constraint_new (rects[Center], CLUTTER_BIND_X, 0.0);
clutter_actor_add_constraint_with_name (rect, "x-bind", constraint); clutter_actor_add_constraint_with_name (rect, "x-bind", constraint);

View File

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

View File

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