[gnome-builder] three-grid: add support for LTR languages
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] three-grid: add support for LTR languages
- Date: Mon, 10 Oct 2016 20:06:51 +0000 (UTC)
commit db75a05c4349a7b063214b98fce5c2c6665fb769
Author: Christian Hergert <chergert redhat com>
Date: Mon Oct 10 13:05:38 2016 -0700
three-grid: add support for LTR languages
We need to flip the left/right columns when under an LTR
language. We can do our layout calculations without taking
this into account since they will be matched in size anyway.
https://bugzilla.gnome.org/show_bug.cgi?id=772705
contrib/egg/egg-three-grid.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/contrib/egg/egg-three-grid.c b/contrib/egg/egg-three-grid.c
index 8d05df4..56f887a 100644
--- a/contrib/egg/egg-three-grid.c
+++ b/contrib/egg/egg-three-grid.c
@@ -433,6 +433,7 @@ egg_three_grid_size_allocate (GtkWidget *widget,
g_autofree GtkRequestedSize *rows = NULL;
const GList *iter;
GtkAllocation area;
+ GtkTextDirection dir;
GList *values;
guint i;
guint n_rows;
@@ -452,6 +453,8 @@ egg_three_grid_size_allocate (GtkWidget *widget,
g_assert (EGG_IS_THREE_GRID (self));
g_assert (allocation != NULL);
+ dir = gtk_widget_get_direction (widget);
+
gtk_widget_set_allocation (widget, allocation);
egg_three_grid_get_preferred_height_for_width (widget, allocation->width, &min_height, &nat_height);
@@ -540,7 +543,10 @@ egg_three_grid_size_allocate (GtkWidget *widget,
child_alloc.width = left;
child_alloc.y = area.y;
child_alloc.height = size->minimum_size;
- egg_three_grid_size_allocate_children (self, EGG_THREE_GRID_COLUMN_LEFT, row_info->row, &child_alloc,
baseline);
+ if (dir == GTK_TEXT_DIR_LTR)
+ egg_three_grid_size_allocate_children (self, EGG_THREE_GRID_COLUMN_LEFT, row_info->row,
&child_alloc, baseline);
+ else
+ egg_three_grid_size_allocate_children (self, EGG_THREE_GRID_COLUMN_RIGHT, row_info->row,
&child_alloc, baseline);
child_alloc.x = area.x + left + priv->column_spacing;
child_alloc.width = center;
@@ -552,7 +558,10 @@ egg_three_grid_size_allocate (GtkWidget *widget,
child_alloc.width = right;
child_alloc.y = area.y;
child_alloc.height = size->minimum_size;
- egg_three_grid_size_allocate_children (self, EGG_THREE_GRID_COLUMN_RIGHT, row_info->row, &child_alloc,
baseline);
+ if (dir == GTK_TEXT_DIR_LTR)
+ egg_three_grid_size_allocate_children (self, EGG_THREE_GRID_COLUMN_RIGHT, row_info->row,
&child_alloc, baseline);
+ else
+ egg_three_grid_size_allocate_children (self, EGG_THREE_GRID_COLUMN_LEFT, row_info->row,
&child_alloc, baseline);
area.y += child_alloc.height + priv->row_spacing;
area.height -= child_alloc.height + priv->row_spacing;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]