[gnome-shell] calendar: Fix for RTL locales



commit 6077e28f95d152513829a96553900180027bbdd2
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Jun 20 16:10:08 2014 +0200

    calendar: Fix for RTL locales
    
    Unlike StTable, ClutterTableLayout does not take the actor's text
    direction into account, so mirror columns ourselves now.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=731923

 js/ui/calendar.js |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index 4453de8..5a387f1 100644
--- a/js/ui/calendar.js
+++ b/js/ui/calendar.js
@@ -480,7 +480,11 @@ const Calendar = new Lang.Class({
             let customDayAbbrev = _getCalendarDayAbbreviation(iter.getDay());
             let label = new St.Label({ style_class: 'calendar-day-base calendar-day-heading',
                                        text: customDayAbbrev });
-            let col = offsetCols + (7 + iter.getDay() - this._weekStart) % 7;
+            let col;
+            if (this.actor.get_text_direction() == Clutter.TextDirection.RTL)
+                col = 6 - (7 + iter.getDay() - this._weekStart) % 7;
+            else
+                col = offsetCols + (7 + iter.getDay() - this._weekStart) % 7;
             layout.pack(label, col, 1);
             iter.setTime(iter.getTime() + MSECS_IN_DAY);
         }
@@ -648,7 +652,11 @@ const Calendar = new Lang.Class({
             button.style_class = styleClass;
 
             let offsetCols = this._useWeekdate ? 1 : 0;
-            let col = offsetCols + (7 + iter.getDay() - this._weekStart) % 7;
+            let col;
+            if (rtl)
+                col = 6 - (7 + iter.getDay() - this._weekStart) % 7;
+            else
+                col = offsetCols + (7 + iter.getDay() - this._weekStart) % 7;
             layout.pack(button, col, row);
 
             this._buttons.push(button);
@@ -656,7 +664,7 @@ const Calendar = new Lang.Class({
             if (this._useWeekdate && iter.getDay() == 4) {
                 let label = new St.Label({ text: _getCalendarWeekForDate(iter).toString(),
                                            style_class: 'calendar-day-base calendar-week-number'});
-                layout.pack(label, 0, row);
+                layout.pack(label, rtl ? 7 : 0, row);
             }
 
             iter.setTime(iter.getTime() + MSECS_IN_DAY);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]