summaryrefslogtreecommitdiff
path: root/overrides
diff options
context:
space:
mode:
authorFernando Farfan <ffarfan@gmail.com>2014-10-20 16:26:11 -0600
committerFernando Farfan <ffarfan@gmail.com>2014-10-20 16:26:11 -0600
commita28199dd6b47652c26126912b302bf0115343d00 (patch)
treed0341b0b944a1d9e68a8e575bb8a1b49a14ceb79 /overrides
parentc767a39f71d4afb953eba04d3a0c6d199990998d (diff)
Topbar nav buttons are flipped on RTL locales
The topbar navigation buttons are flipped on right-to-left (rtl) locales. On this version of GTK, we manually select the corresponding -rtl icon names. Notice that styling is also flipped.
Diffstat (limited to 'overrides')
-rw-r--r--overrides/endless_private/topbar_nav_button.js20
1 files changed, 18 insertions, 2 deletions
diff --git a/overrides/endless_private/topbar_nav_button.js b/overrides/endless_private/topbar_nav_button.js
index 541b122..ef79094 100644
--- a/overrides/endless_private/topbar_nav_button.js
+++ b/overrides/endless_private/topbar_nav_button.js
@@ -23,14 +23,30 @@ const TopbarNavButton = new Lang.Class({
props.orientation = Gtk.Orientation.HORIZONTAL;
this.parent(props);
- this._back_button = Gtk.Button.new_from_icon_name('topbar-go-previous-symbolic',
+ let back_button_image;
+ let forward_button_image;
+ let is_rtl = this.get_default_direction() === Gtk.TextDirection.RTL ? true : false;
+ if (is_rtl) {
+ back_button_image = 'topbar-go-previous-rtl-symbolic';
+ forward_button_image = 'topbar-go-next-rtl-symbolic';
+ } else {
+ back_button_image = 'topbar-go-previous-symbolic';
+ forward_button_image = 'topbar-go-next-symbolic';
+ }
+
+ this._back_button = Gtk.Button.new_from_icon_name(back_button_image,
Gtk.IconSize.SMALL_TOOLBAR);
- this._forward_button = Gtk.Button.new_from_icon_name('topbar-go-next-symbolic',
+ this._forward_button = Gtk.Button.new_from_icon_name(forward_button_image,
Gtk.IconSize.SMALL_TOOLBAR);
this._back_button.get_style_context().add_class('back');
this._forward_button.get_style_context().add_class('forward');
+ if (is_rtl) {
+ this._back_button.get_style_context().add_class('rtl');
+ this._forward_button.get_style_context().add_class('rtl');
+ }
+
[this._back_button, this._forward_button].forEach(function (button) {
button.can_focus = false;
button.add_events(Gdk.EventMask.ENTER_NOTIFY_MASK |