flow-layout: Add :snap-to-grid property

Add a :snap-to-grid property to FlowLayout to prevent the layout from
assigning it's children a position based on the size of the largest
child.

https://bugzilla.gnome.org/show_bug.cgi?id=648873
This commit is contained in:
Bastian Winkler
2013-05-03 11:53:44 -04:00
committed by Erick Pérez Castellanos
parent fd9109e6d6
commit cd9ba0ad8d
5 changed files with 182 additions and 43 deletions

View File

@ -9,6 +9,7 @@ static gboolean is_homogeneous = FALSE;
static gboolean vertical = FALSE;
static gboolean random_size = FALSE;
static gboolean fixed_size = FALSE;
static gboolean snap_to_grid = TRUE;
static gint n_rects = N_RECTS;
static gint x_spacing = 0;
@ -64,6 +65,13 @@ static GOptionEntry entries[] = {
&fixed_size,
"Fix the layout size", NULL
},
{
"no-snap-to-grid", 's',
G_OPTION_FLAG_REVERSE,
G_OPTION_ARG_NONE,
&snap_to_grid,
"Don't snap elements to grid", NULL
},
{ NULL }
};
@ -102,6 +110,8 @@ main (int argc, char *argv[])
x_spacing);
clutter_flow_layout_set_row_spacing (CLUTTER_FLOW_LAYOUT (layout),
y_spacing);
clutter_flow_layout_set_snap_to_grid (CLUTTER_FLOW_LAYOUT (layout),
snap_to_grid);
box = clutter_actor_new ();
clutter_actor_set_layout_manager (box, layout);