From: John Darrington <john@darrington.wattle.id.au>
Date: Sat, 28 Nov 2015 20:26:51 +0000 (+0100)
Subject: Correct the rendering of the data and variable sheets in RTL locales
X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5189d896f623b7db3b7f592c1cdf4cd855add27b;p=pspp

Correct the rendering of the data and variable sheets in RTL locales
---

diff --git a/NEWS b/NEWS
index f7deed7fa7..bb63af173b 100644
--- a/NEWS
+++ b/NEWS
@@ -40,6 +40,9 @@ Changes from 0.8.5 to 0.9.0:
      For compatibility, the behavior that ESCAPE enabled is now the
      default and only supported behavior.
 
+   - Rendering of the variable and data sheets in right-to-left locales
+     now works properly.
+
 Changes from 0.8.4 to 0.8.5:
 
  * The FREQUENCIES and CROSSTABS commands can now generate barcharts.
diff --git a/src/ui/gui/pspp-sheet-view.c b/src/ui/gui/pspp-sheet-view.c
index ad86bd69d8..79a1d5320a 100644
--- a/src/ui/gui/pspp-sheet-view.c
+++ b/src/ui/gui/pspp-sheet-view.c
@@ -2032,6 +2032,9 @@ pspp_sheet_view_size_allocate (GtkWidget     *widget,
   if (allocation->width != old_allocation.width)
     width_changed = TRUE;
 
+  if (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL)   
+    allocation->x += allocation->width - tree_view->priv->width ;
+
   gtk_widget_set_allocation (widget, allocation);
 
   /* We size-allocate the columns first because the width of the
@@ -3833,7 +3836,11 @@ pspp_sheet_view_draw_vertical_grid_lines (PsppSheetView    *tree_view,
     return;
 
   /* Only draw the lines for visible rows and columns */
-  for (list = tree_view->priv->columns; list; list = list->next, i++)
+  gboolean rtl = (gtk_widget_get_direction (tree_view) == GTK_TEXT_DIR_RTL);
+
+  for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
+       list;
+       list = (rtl ? list->prev : list->next))
     {
       PsppSheetViewColumn *column = list->data;
       gint x;