Distinguish between gnome-shell 3.9 and lower, make it work on 3.8 (and lower ?) again; NOTE: only tested on 3.8 and 3.10 (might be broken on 3.9 and on versions lower than 3.8)

yahoo_weather
Jens Lody 11 years ago
parent 712bd6458e
commit 91dc39184a
  1. 29
      src/extension.js

@ -35,6 +35,7 @@
const ExtensionUtils = imports.misc.extensionUtils; const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension(); const Me = ExtensionUtils.getCurrentExtension();
const Config = imports.misc.config;
const Convenience = Me.imports.convenience; const Convenience = Me.imports.convenience;
const Cairo = imports.cairo; const Cairo = imports.cairo;
const Clutter = imports.gi.Clutter; const Clutter = imports.gi.Clutter;
@ -196,16 +197,26 @@ const WeatherMenuButton = new Lang.Class({
this._futureWeather = new St.Bin({ style_class: 'forecast'}); this._futureWeather = new St.Bin({ style_class: 'forecast'});
// Putting the popup item together // Putting the popup item together
this._itemCurrent = new PopupMenu.PopupBaseMenuItem({reactive:false,style_class: 'current'}); let _itemCurrent = new PopupMenu.PopupBaseMenuItem({reactive:false});
this._itemCurrent.actor.add_actor(this._currentWeather); let _itemFuture = new PopupMenu.PopupBaseMenuItem({reactive:false});
this.menu.addMenuItem(this._itemCurrent);
if(ExtensionUtils.versionCheck(['3.9','3.10'], Config.PACKAGE_VERSION))
{
_itemCurrent.actor.add_actor(this._currentWeather);
_itemFuture.actor.add_actor(this._futureWeather);
}
else
{
_itemCurrent.addActor(this._currentWeather);
_itemFuture.addActor(this._futureWeather);
}
this.menu.addMenuItem(_itemCurrent);
let item = new PopupMenu.PopupSeparatorMenuItem(); let item = new PopupMenu.PopupSeparatorMenuItem();
this.menu.addMenuItem(item); this.menu.addMenuItem(item);
this._itemFuture = new PopupMenu.PopupBaseMenuItem({reactive:false,style_class: 'forecast'}); this.menu.addMenuItem(_itemFuture);
this._itemFuture.actor.add_actor(this._futureWeather);
this.menu.addMenuItem(this._itemFuture);
let item = new PopupMenu.PopupSeparatorMenuItem(); let item = new PopupMenu.PopupSeparatorMenuItem();
this.menu.addMenuItem(item); this.menu.addMenuItem(item);
@ -521,7 +532,13 @@ const WeatherMenuButton = new Lang.Class({
item = new PopupMenu.PopupMenuItem(this.extractLocation(cities[i])); item = new PopupMenu.PopupMenuItem(this.extractLocation(cities[i]));
item.location = i; item.location = i;
if(i == this._actual_city) if(i == this._actual_city)
{
if(ExtensionUtils.versionCheck(['3.9','3.10'], Config.PACKAGE_VERSION))
item.setOrnament(PopupMenu.Ornament.DOT); item.setOrnament(PopupMenu.Ornament.DOT);
else
item.setShowDot(true);
}
this._selectCity.menu.addMenuItem(item); this._selectCity.menu.addMenuItem(item);
item.connect('activate', function(actor,event) item.connect('activate', function(actor,event)
{ {

Loading…
Cancel
Save