From 7bb14bd8da556ae44267a388ca237ac6c805e301 Mon Sep 17 00:00:00 2001 From: Abderrahim Kitouni Date: Fri, 25 Dec 2009 09:34:40 +0100 Subject: [PATCH] calendar.js: switch buttons direction in RTL mode also don't hang if translation of 'calendar:week_start:0' is incorrect https://bugzilla.gnome.org/show_bug.cgi?id=584662 --- js/ui/calendar.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/js/ui/calendar.js b/js/ui/calendar.js index d8b380ae7..81673c7b6 100644 --- a/js/ui/calendar.js +++ b/js/ui/calendar.js @@ -31,7 +31,7 @@ Calendar.prototype = { if (isNaN(this._weekStart) || this._weekStart < 0 || this._weekStart > 6) { log("Translation of 'calendar:week_start:0' in GTK+ is not correct"); - this.weekStart = 0; + this._weekStart = 0; } // Find the ordering for month/year in the calendar heading @@ -63,14 +63,19 @@ Calendar.prototype = { this.actor.add(this._topBox, { row: 0, col: 0, col_span: 7 }); - let back = new St.Button({ label: "<", style_class: 'calendar-change-month' }); + let [backlabel, forwardlabel] = ["<", ">"]; + if (St.Widget.get_default_direction () == St.TextDirection.RTL) { + [backlabel, forwardlabel] = [forwardlabel, backlabel]; + } + + let back = new St.Button({ label: backlabel, style_class: 'calendar-change-month' }); this._topBox.add(back); back.connect("clicked", Lang.bind(this, this._prevMonth)); this._dateLabel = new St.Label(); this._topBox.add(this._dateLabel, { expand: true, x_fill: false, x_align: St.Align.MIDDLE }); - let forward = new St.Button({ label: ">", style_class: 'calendar-change-month' }); + let forward = new St.Button({ label: forwardlabel, style_class: 'calendar-change-month' }); this._topBox.add(forward); forward.connect("clicked", Lang.bind(this, this._nextMonth));