Add link to openweathermap.org in menu; uses gnome-open to open forecast page of the actual city if possible, fallback is openweathermaps main page.

openweathermap
Jens Lody 11 years ago
parent 8db3bc02d9
commit 0fa1fdb477
  1. 4
      data/stylesheet.css
  2. 20
      src/extension.js

@ -1,3 +1,7 @@
.weather-provider {
font-size: 110%;
}
.weather-current-summarybox {
padding-top:5px;
}

@ -233,6 +233,26 @@ const WeatherMenuButton = new Lang.Class({
let item = new PopupMenu.PopupSeparatorMenuItem();
this.menu.addMenuItem(item);
let item = new PopupMenu.PopupMenuItem(_("Weather data provided by: ") + ("http://openweathermap.org/"), {
style_class: 'weather-provider'
});
item.connect('activate', Lang.bind(this, function() {
let cityId = this.extractId(this._city);
if (!cityId) {
this.updateCities();
cityId = this.extractId(this._city);
}
if (cityId)
Util.spawn(["gnome-open", "http://openweathermap.org/city/" + cityId]);
else
Util.spawn(["gnome-open", "http://openweathermap.org"]);
}));
this.menu.addMenuItem(item);
let item = new PopupMenu.PopupSeparatorMenuItem();
this.menu.addMenuItem(item);
this._selectCity = new PopupMenu.PopupSubMenuMenuItem(_("Locations"));
this.menu.addMenuItem(this._selectCity);
this.rebuildSelectCityItem();

Loading…
Cancel
Save