diff options
author | Matthias Clasen <mclasen@redhat.com> | 2011-10-25 23:18:21 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2011-10-25 23:21:13 -0400 |
commit | 362ff7bedff9f287193be30a7b4ee6199b7164eb (patch) | |
tree | 588785c916b41ca3e6d34310dc9ba67df31419f6 /gtk/gtkgrid.c | |
parent | 7f80ee3a38e0e217b0e3f5886a79fe175a8a6913 (diff) | |
download | gtk+-362ff7bedff9f287193be30a7b4ee6199b7164eb.tar.gz |
Fix gtk_grid_attach_next_to
The function did not behave as intended when @sibling is NULL.
Also add an example to the docs to clarify the intended behaviour.
Diffstat (limited to 'gtk/gtkgrid.c')
-rw-r--r-- | gtk/gtkgrid.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/gtk/gtkgrid.c b/gtk/gtkgrid.c index 5ef4a6f794..da66a22e63 100644 --- a/gtk/gtkgrid.c +++ b/gtk/gtkgrid.c @@ -1470,6 +1470,9 @@ gtk_grid_attach (GtkGrid *grid, * @side. When @sibling is %NULL, the widget is placed in row (for * left or right placement) or column 0 (for top or bottom placement), * at the end indicated by @side. + * + * Attaching widgets labeled [1], [2], [3] with @sibling == %NULL and + * @side == %GTK_POS_LEFT yields a layout of [3][2][1]. */ void gtk_grid_attach_next_to (GtkGrid *grid, @@ -1520,20 +1523,22 @@ gtk_grid_attach_next_to (GtkGrid *grid, switch (side) { case GTK_POS_LEFT: - left = find_attach_position (grid, GTK_ORIENTATION_HORIZONTAL, 0, height, TRUE); + left = find_attach_position (grid, GTK_ORIENTATION_HORIZONTAL, 0, height, FALSE); + left -= width; top = 0; break; case GTK_POS_RIGHT: - left = find_attach_position (grid, GTK_ORIENTATION_HORIZONTAL, 0, height, FALSE); + left = find_attach_position (grid, GTK_ORIENTATION_HORIZONTAL, 0, height, TRUE); top = 0; break; case GTK_POS_TOP: left = 0; - top = find_attach_position (grid, GTK_ORIENTATION_VERTICAL, 0, width, TRUE); + top = find_attach_position (grid, GTK_ORIENTATION_VERTICAL, 0, width, FALSE); + top -= height; break; case GTK_POS_BOTTOM: left = 0; - top = find_attach_position (grid, GTK_ORIENTATION_VERTICAL, 0, width, FALSE); + top = find_attach_position (grid, GTK_ORIENTATION_VERTICAL, 0, width, TRUE); break; default: g_assert_not_reached (); |