|
|
@ -30,6 +30,7 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
const Cairo = imports.cairo; |
|
|
|
const Cairo = imports.cairo; |
|
|
|
|
|
|
|
const Clutter = imports.gi.Clutter; |
|
|
|
const Gettext = imports.gettext.domain('gnome-shell-extension-weather'); |
|
|
|
const Gettext = imports.gettext.domain('gnome-shell-extension-weather'); |
|
|
|
const Gio = imports.gi.Gio; |
|
|
|
const Gio = imports.gi.Gio; |
|
|
|
const Gtk = imports.gi.Gtk; |
|
|
|
const Gtk = imports.gi.Gtk; |
|
|
@ -83,21 +84,39 @@ WeatherMenuButton.prototype = { |
|
|
|
// Load settings
|
|
|
|
// Load settings
|
|
|
|
this.loadConfig(); |
|
|
|
this.loadConfig(); |
|
|
|
|
|
|
|
|
|
|
|
// Panel icon
|
|
|
|
|
|
|
|
this._weatherIcon = new St.Icon({ |
|
|
|
|
|
|
|
icon_type: this._icon_type, |
|
|
|
|
|
|
|
icon_name: 'view-refresh-symbolic', |
|
|
|
|
|
|
|
style_class: 'system-status-icon weather-icon' + (Main.panel.actor.get_direction() == St.TextDirection.RTL ? '-rtl' : '') |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Label
|
|
|
|
// Label
|
|
|
|
this._weatherInfo = new St.Label({ text: _('...') }); |
|
|
|
this._weatherInfo = new St.Label({ text: _('...') }); |
|
|
|
|
|
|
|
|
|
|
|
// Panel menu item - the current class
|
|
|
|
if(typeof St.TextDirection == "undefined") |
|
|
|
let menuAlignment = 0.25; |
|
|
|
{ |
|
|
|
if (St.Widget.get_default_direction() == St.TextDirection.RTL) |
|
|
|
// Panel icon
|
|
|
|
menuAlignment = 1.0 - menuAlignment; |
|
|
|
this._weatherIcon = new St.Icon({ |
|
|
|
PanelMenu.Button.prototype._init.call(this, menuAlignment); |
|
|
|
icon_type: this._icon_type, |
|
|
|
|
|
|
|
icon_name: 'view-refresh-symbolic', |
|
|
|
|
|
|
|
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; |
|
|
|
|
|
|
|
PanelMenu.Button.prototype._init.call(this, menuAlignment); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Panel icon
|
|
|
|
|
|
|
|
this._weatherIcon = new St.Icon({ |
|
|
|
|
|
|
|
icon_type: this._icon_type, |
|
|
|
|
|
|
|
icon_name: 'view-refresh-symbolic', |
|
|
|
|
|
|
|
style_class: 'system-status-icon weather-icon' + (Main.panel.actor.get_direction() == St.TextDirection.RTL ? '-rtl' : '') |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Putting the panel item together
|
|
|
|
// Putting the panel item together
|
|
|
|
let topBox = new St.BoxLayout(); |
|
|
|
let topBox = new St.BoxLayout(); |
|
|
@ -231,6 +250,8 @@ WeatherMenuButton.prototype = { |
|
|
|
cities = [cities]; |
|
|
|
cities = [cities]; |
|
|
|
|
|
|
|
|
|
|
|
var l = cities.length-1; |
|
|
|
var l = cities.length-1; |
|
|
|
|
|
|
|
global.log(a < 0); |
|
|
|
|
|
|
|
global.log(a); |
|
|
|
|
|
|
|
|
|
|
|
if(a < 0) |
|
|
|
if(a < 0) |
|
|
|
a = 0; |
|
|
|
a = 0; |
|
|
|