[gtk+] tests: Make prop-editor use a grid instead of a table
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] tests: Make prop-editor use a grid instead of a table
- Date: Wed, 28 Sep 2011 03:35:15 +0000 (UTC)
commit 3111ac0b1a0dacd7d9f7a824dc817cdccebdd66e
Author: Benjamin Otte <otte redhat com>
Date: Tue Sep 27 21:32:35 2011 +0200
tests: Make prop-editor use a grid instead of a table
tests/prop-editor.c | 56 +++++++++++++++++++++++++-------------------------
1 files changed, 28 insertions(+), 28 deletions(-)
---
diff --git a/tests/prop-editor.c b/tests/prop-editor.c
index 674fb0c..1abac95 100644
--- a/tests/prop-editor.c
+++ b/tests/prop-editor.c
@@ -1020,7 +1020,7 @@ properties_from_type (GObject *object,
GtkWidget *label;
GtkWidget *sw;
GtkWidget *vbox;
- GtkWidget *table;
+ GtkWidget *grid;
GParamSpec **specs;
guint n_specs;
int i;
@@ -1041,9 +1041,9 @@ properties_from_type (GObject *object,
return NULL;
}
- table = gtk_table_new (n_specs, 2, FALSE);
- gtk_table_set_col_spacing (GTK_TABLE (table), 0, 10);
- gtk_table_set_row_spacings (GTK_TABLE (table), 3);
+ grid = gtk_grid_new ();
+ gtk_grid_set_column_spacing (GTK_GRID (grid), 10);
+ gtk_grid_set_row_spacing (GTK_GRID (grid), 3);
i = 0;
while (i < n_specs)
@@ -1073,10 +1073,10 @@ properties_from_type (GObject *object,
label = gtk_label_new (g_param_spec_get_nick (spec));
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, i, i + 1);
+ gtk_grid_attach (GTK_GRID (grid), label, 0, i, 1, 1);
prop_edit = property_widget (object, spec, can_modify);
- gtk_table_attach_defaults (GTK_TABLE (table), prop_edit, 1, 2, i, i + 1);
+ gtk_grid_attach (GTK_GRID (grid), prop_edit, 1, i, 1, 1);
/* set initial value */
g_object_notify (object, spec->name);
@@ -1086,7 +1086,7 @@ properties_from_type (GObject *object,
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), grid, FALSE, FALSE, 0);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
@@ -1106,7 +1106,7 @@ child_properties_from_object (GObject *object)
GtkWidget *label;
GtkWidget *sw;
GtkWidget *vbox;
- GtkWidget *table;
+ GtkWidget *grid;
GtkWidget *parent;
GParamSpec **specs;
guint n_specs;
@@ -1122,9 +1122,9 @@ child_properties_from_object (GObject *object)
specs = gtk_container_class_list_child_properties (G_OBJECT_GET_CLASS (parent), &n_specs);
- table = gtk_table_new (n_specs, 2, FALSE);
- gtk_table_set_col_spacing (GTK_TABLE (table), 0, 10);
- gtk_table_set_row_spacings (GTK_TABLE (table), 3);
+ grid = gtk_grid_new ();
+ gtk_grid_set_column_spacing (GTK_GRID (grid), 10);
+ gtk_grid_set_row_spacing (GTK_GRID (grid), 3);
i = 0;
while (i < n_specs)
@@ -1147,11 +1147,11 @@ child_properties_from_object (GObject *object)
label = gtk_label_new (g_param_spec_get_nick (spec));
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, i, i + 1);
+ gtk_grid_attach (GTK_GRID (grid), label, 0, i, 1, 1);
mark_child_property (spec);
prop_edit = property_widget (object, spec, can_modify);
- gtk_table_attach_defaults (GTK_TABLE (table), prop_edit, 1, 2, i, i + 1);
+ gtk_grid_attach (GTK_GRID (grid), prop_edit, 1, i, 1, 1);
/* set initial value */
gtk_widget_child_notify (GTK_WIDGET (object), spec->name);
@@ -1160,7 +1160,7 @@ child_properties_from_object (GObject *object)
}
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), grid, FALSE, FALSE, 0);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
@@ -1184,7 +1184,7 @@ static GtkWidget *
children_from_object (GObject *object)
{
GList *children, *c;
- GtkWidget *table, *label, *prop_edit, *button, *vbox, *sw;
+ GtkWidget *grid, *label, *prop_edit, *button, *vbox, *sw;
gchar *str;
gint i;
@@ -1193,9 +1193,9 @@ children_from_object (GObject *object)
children = gtk_container_get_children (GTK_CONTAINER (object));
- table = gtk_table_new (g_list_length (children), 2, FALSE);
- gtk_table_set_col_spacing (GTK_TABLE (table), 0, 10);
- gtk_table_set_row_spacings (GTK_TABLE (table), 3);
+ grid = gtk_grid_new ();
+ gtk_grid_set_column_spacing (GTK_GRID (grid), 10);
+ gtk_grid_set_row_spacing (GTK_GRID (grid), 3);
for (c = children, i = 0; c; c = c->next, i++)
{
@@ -1204,7 +1204,7 @@ children_from_object (GObject *object)
label = gtk_label_new ("Child");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, i, i + 1);
+ gtk_grid_attach (GTK_GRID (grid), label, 0, i, 1, 1);
prop_edit = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
@@ -1219,11 +1219,11 @@ children_from_object (GObject *object)
gtk_container_add (GTK_CONTAINER (prop_edit), label);
gtk_container_add (GTK_CONTAINER (prop_edit), button);
- gtk_table_attach_defaults (GTK_TABLE (table), prop_edit, 1, 2, i, i + 1);
+ gtk_grid_attach (GTK_GRID (grid), prop_edit, 1, i, 1, 1);
}
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), grid, FALSE, FALSE, 0);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
@@ -1240,7 +1240,7 @@ static GtkWidget *
cells_from_object (GObject *object)
{
GList *cells, *c;
- GtkWidget *table, *label, *prop_edit, *button, *vbox, *sw;
+ GtkWidget *grid, *label, *prop_edit, *button, *vbox, *sw;
gchar *str;
gint i;
@@ -1249,9 +1249,9 @@ cells_from_object (GObject *object)
cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (object));
- table = gtk_table_new (g_list_length (cells), 2, FALSE);
- gtk_table_set_col_spacing (GTK_TABLE (table), 0, 10);
- gtk_table_set_row_spacings (GTK_TABLE (table), 3);
+ grid = gtk_grid_new ();
+ gtk_grid_set_column_spacing (GTK_GRID (grid), 10);
+ gtk_grid_set_row_spacing (GTK_GRID (grid), 3);
for (c = cells, i = 0; c; c = c->next, i++)
{
@@ -1260,7 +1260,7 @@ cells_from_object (GObject *object)
label = gtk_label_new ("Cell");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, i, i + 1);
+ gtk_grid_attach (GTK_GRID (grid), label, 0, i, 1, 1);
prop_edit = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
@@ -1275,11 +1275,11 @@ cells_from_object (GObject *object)
gtk_container_add (GTK_CONTAINER (prop_edit), label);
gtk_container_add (GTK_CONTAINER (prop_edit), button);
- gtk_table_attach_defaults (GTK_TABLE (table), prop_edit, 1, 2, i, i + 1);
+ gtk_grid_attach (GTK_GRID (grid), prop_edit, 1, i, 1, 1);
}
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), grid, FALSE, FALSE, 0);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]