From 061e60daa551446e66463298df6e5d5465440735 Mon Sep 17 00:00:00 2001 From: Jens Lody Date: Sat, 9 Aug 2014 22:59:40 +0200 Subject: [PATCH] Use pseudo-classes to differentiate between ltr and rtl, only use clutter textdirection to make source more clear. --- data/stylesheet.css | 4 ++-- src/extension.js | 33 +++++++++------------------------ 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/data/stylesheet.css b/data/stylesheet.css index ad28185..1b1fa31 100644 --- a/data/stylesheet.css +++ b/data/stylesheet.css @@ -24,11 +24,11 @@ padding-right: 30px; padding-right: 20px; } -.weather-icon { +.weather-icon:ltr { padding-right: 5px; } -.weather-icon-rtl { +.weather-icon:rtl { padding-left: 5px; } diff --git a/src/extension.js b/src/extension.js index c4d358f..1398552 100644 --- a/src/extension.js +++ b/src/extension.js @@ -144,31 +144,16 @@ const WeatherMenuButton = new Lang.Class({ text: _('...') }); - if (St.TextDirection === undefined) { - // Panel icon - this._weatherIcon = new St.Icon({ - icon_name: 'view-refresh' + this.icon_type(), - style_class: 'system-status-icon weather-icon' + (Main.panel.actor.get_text_direction() == Clutter.TextDirection.RTL ? '-rtl' : '') - }); - - // Panel menu item - the current class - let menuAlignment = 0.25; - if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) - menuAlignment = 1.0 - menuAlignment; - this.parent(menuAlignment); - } else { - // Panel icon - this._weatherIcon = new St.Icon({ - icon_name: 'view-refresh' + this.icon_type(), - style_class: 'system-status-icon weather-icon' + (Main.panel.actor.get_direction() == St.TextDirection.RTL ? '-rtl' : '') - }); + this._weatherIcon = new St.Icon({ + icon_name: 'view-refresh' + this.icon_type(), + style_class: 'system-status-icon weather-icon' + }); - // Panel menu item - the current class - let menuAlignment = 0.25; - if (St.Widget.get_default_direction() == St.TextDirection.RTL) - menuAlignment = 1.0 - menuAlignment; - PanelMenu.Button.prototype._init.call(this, menuAlignment); - } + // Panel menu item - the current class + let menuAlignment = 0.25; + if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) + menuAlignment = 1.0 - menuAlignment; + this.parent(menuAlignment); // Putting the panel item together let topBox = new St.BoxLayout();