[clutter] interactive/text-field: Modernize
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] interactive/text-field: Modernize
- Date: Tue, 7 Feb 2012 12:06:03 +0000 (UTC)
commit 1d55af9dfacb7cc3bad2e36644b8933ddd6f87ca
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Tue Feb 7 11:30:43 2012 +0000
interactive/text-field: Modernize
tests/interactive/test-text-field.c | 79 ++++++++++++++++++----------------
1 files changed, 42 insertions(+), 37 deletions(-)
---
diff --git a/tests/interactive/test-text-field.c b/tests/interactive/test-text-field.c
index 2897bef..e40fb70 100644
--- a/tests/interactive/test-text-field.c
+++ b/tests/interactive/test-text-field.c
@@ -271,11 +271,11 @@ test_text_field_main (gint argc,
gchar **argv)
{
ClutterActor *stage;
- ClutterActor *box, *entry;
+ ClutterActor *box, *label, *entry;
ClutterLayoutManager *table;
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
- return 1;
+ return EXIT_FAILURE;
stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "Text Fields");
@@ -286,48 +286,53 @@ test_text_field_main (gint argc,
clutter_table_layout_set_column_spacing (CLUTTER_TABLE_LAYOUT (table), 6);
clutter_table_layout_set_row_spacing (CLUTTER_TABLE_LAYOUT (table), 6);
- box = clutter_box_new (table);
- clutter_container_add_actor (CLUTTER_CONTAINER (stage), box);
+ box = clutter_actor_new ();
+ clutter_actor_set_layout_manager (box, table);
clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_WIDTH, -24.0));
clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_HEIGHT, -24.0));
clutter_actor_set_position (box, 12, 12);
-
- clutter_box_pack (CLUTTER_BOX (box),
- create_label (CLUTTER_COLOR_White, "<b>Input field:</b>"),
- "row", 0,
- "column", 0,
- "x-expand", FALSE,
- "y-expand", FALSE,
- NULL);
+ clutter_actor_add_child (stage, box);
+
+ label = create_label (CLUTTER_COLOR_White, "<b>Input field:</b>");
+ g_object_set (label, "min-width", 150.0, NULL);
+ clutter_actor_add_child (box, label);
+ clutter_layout_manager_child_set (table, CLUTTER_CONTAINER (box), label,
+ "row", 0,
+ "column", 0,
+ "x-expand", FALSE,
+ "y-expand", FALSE,
+ NULL);
entry = create_entry (CLUTTER_COLOR_LightGray, "<i>some</i> text", 0, 0);
- clutter_box_pack (CLUTTER_BOX (box),
- entry,
- "row", 0,
- "column", 1,
- "x-expand", TRUE,
- "x-fill", TRUE,
- "y-expand", FALSE,
- NULL);
-
- clutter_box_pack (CLUTTER_BOX (box),
- create_label (CLUTTER_COLOR_White, "<b>A very long password field:</b>"),
- "row", 1,
- "column", 0,
- "x-expand", FALSE,
- "y-expand", FALSE,
- NULL);
+ clutter_actor_add_child (box, entry);
+ clutter_layout_manager_child_set (table, CLUTTER_CONTAINER (box), entry,
+ "row", 0,
+ "column", 1,
+ "x-expand", TRUE,
+ "x-fill", TRUE,
+ "y-expand", FALSE,
+ NULL);
+ clutter_actor_grab_key_focus (entry);
- clutter_box_pack (CLUTTER_BOX (box),
- create_entry (CLUTTER_COLOR_LightGray, "password", '*', 8),
- "row", 1,
- "column", 1,
- "x-expand", TRUE,
- "x-fill", TRUE,
- "y-expand", FALSE,
- NULL);
+ label = create_label (CLUTTER_COLOR_White, "<b>A very long password field:</b>");
+ clutter_actor_add_child (box, label);
+ clutter_layout_manager_child_set (table, CLUTTER_CONTAINER (box), label,
+ "row", 1,
+ "column", 0,
+ "x-expand", FALSE,
+ "y-expand", FALSE,
+ NULL);
+
+ entry = create_entry (CLUTTER_COLOR_LightGray, "password", '*', 8);
+ clutter_actor_add_child (box, entry);
+ clutter_layout_manager_child_set (table, CLUTTER_CONTAINER (box), entry,
+ "row", 1,
+ "column", 1,
+ "x-expand", TRUE,
+ "x-fill", TRUE,
+ "y-expand", FALSE,
+ NULL);
- clutter_actor_grab_key_focus (entry);
clutter_actor_show (stage);
clutter_main ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]