Use pseudo-classes to differentiate between ltr and rtl, only use clutter textdirection to make source more clear.

multiprovider
Jens Lody 11 years ago
parent cad3b3807f
commit 061e60daa5
  1. 4
      data/stylesheet.css
  2. 33
      src/extension.js

@ -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;
}

@ -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();

Loading…
Cancel
Save