Fix for GNOME Shell 3.4 compatibility

yahoo_weather
Neroth 13 years ago
parent 63d314a363
commit 1e0529b5a6
  1. 27
      src/extension.js
  2. 2
      src/metadata.json.in
  3. 10
      src/weather-settings.js.in

@ -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();
// Label
this._weatherInfo = new St.Label({ text: _('...') });
if(typeof St.TextDirection == "undefined")
{
// Panel icon // Panel icon
this._weatherIcon = new St.Icon({ this._weatherIcon = new St.Icon({
icon_type: this._icon_type, icon_type: this._icon_type,
icon_name: 'view-refresh-symbolic', icon_name: 'view-refresh-symbolic',
style_class: 'system-status-icon weather-icon' + (Main.panel.actor.get_direction() == St.TextDirection.RTL ? '-rtl' : '') style_class: 'system-status-icon weather-icon' + (Main.panel.actor.get_text_direction() == Clutter.TextDirection.RTL ? '-rtl' : '')
}); });
// Label // Panel menu item - the current class
this._weatherInfo = new St.Label({ text: _('...') }); 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 // Panel menu item - the current class
let menuAlignment = 0.25; let menuAlignment = 0.25;
if (St.Widget.get_default_direction() == St.TextDirection.RTL) if (St.Widget.get_default_direction() == St.TextDirection.RTL)
menuAlignment = 1.0 - menuAlignment; menuAlignment = 1.0 - menuAlignment;
PanelMenu.Button.prototype._init.call(this, 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;

@ -2,7 +2,7 @@
"uuid": "@uuid@", "uuid": "@uuid@",
"name": "Weather indicator", "name": "Weather indicator",
"description": "Adds weather information menu", "description": "Adds weather information menu",
"shell-version": [ "3.1.90", "3.1.91", "3.1.92", "3.2", "3.3" ], "shell-version": [ "3.1.90", "3.1.91", "3.1.92", "3.2", "3.3", "3.4" ],
"localedir": "@LOCALEDIR@", "localedir": "@LOCALEDIR@",
"url": "@url@" "url": "@url@"
} }

@ -199,7 +199,6 @@ WeatherSetting.prototype =
if(!this.Settings) if(!this.Settings)
this.loadConfig(); this.loadConfig();
var a = this.Settings.get_int(WEATHER_ACTUAL_CITY_KEY); var a = this.Settings.get_int(WEATHER_ACTUAL_CITY_KEY);
var b = a;
var citys = this.city.split(" && "); var citys = this.city.split(" && ");
if(citys && typeof citys == "string") if(citys && typeof citys == "string")
@ -216,8 +215,6 @@ WeatherSetting.prototype =
if(a > l) if(a > l)
a = l; a = l;
if(a != b)
this.actual_city = a;
return a; return a;
}, },
@ -333,6 +330,8 @@ WeatherSetting.prototype =
{ {
this.Window.get_object("tree-toolbutton-remove").sensitive = Boolean(this.city.length); this.Window.get_object("tree-toolbutton-remove").sensitive = Boolean(this.city.length);
if(this.mCities != this.city)
{
if(typeof this.liststore != "undefined") if(typeof this.liststore != "undefined")
this.liststore.clear(); this.liststore.clear();
@ -351,10 +350,13 @@ WeatherSetting.prototype =
var current = a.iter; var current = a.iter;
this.liststore.set_value(current,0,city[i]); this.liststore.set_value(current,0,city[i]);
} }
}
this.changeSelection(); this.mCities = this.city;
} }
this.changeSelection();
var config = this.configWidgets; var config = this.configWidgets;
for(var i in config) for(var i in config)
if(config[i][0].active != this[config[i][1]]) if(config[i][0].active != this[config[i][1]])

Loading…
Cancel
Save