Only use Soup.SessionAsync for gnome-shell < 3.8, because it's deprecated now and leads to many tcp retransmissions; use Soup.Session instead for version >= 3.8 .

multiprovider
Jens Lody 11 years ago
parent 0d20641a1d
commit fffe8fc1b3
  1. 8
      README.md
  2. 13
      src/extension.js
  3. 13
      src/prefs.js

@ -44,14 +44,6 @@ Run the following commands:
cd ~/gnome-shell-extension-weather
./autogen.sh && make local-install
If you want to use openweathermap.org without deprecated Soup.SessionAsync (less TCP Retransmission), please use the openweathermap branch instead.
You need to have at least gnome-shell version 3.8 .
cd ~ && git clone git://github.com/jenslody/gnome-shell-extension-weather.git
cd ~/gnome-shell-extension-weather
git checkout openweathermap
./autogen.sh && make local-install
----
# Configuration

@ -122,9 +122,7 @@ const WEATHER_CONV_MPS_IN_KPH = 3.6;
const WEATHER_CONV_MPS_IN_KNOTS = 1.94384449;
const WEATHER_CONV_MPS_IN_FPS = 3.2808399;
// Soup session (see https://bugzilla.gnome.org/show_bug.cgi?id=661323#c64) (Simon Legner)
const _httpSession = new Soup.SessionAsync();
Soup.Session.prototype.add_feature.call(_httpSession, new Soup.ProxyResolverDefault());
let _httpSession;
const WeatherMenuButton = new Lang.Class({
Name: 'WeatherMenuButton',
@ -1107,6 +1105,15 @@ weather-storm.png = weather-storm-symbolic.svg
},
load_json_async: function(url, params, fun) {
if (_httpSession == undefined) {
if (ExtensionUtils.versionCheck(['3.6', '3.7'], Config.PACKAGE_VERSION)) {
// Soup session (see https://bugzilla.gnome.org/show_bug.cgi?id=661323#c64) (Simon Legner)
_httpSession = new Soup.SessionAsync();
Soup.Session.prototype.add_feature.call(_httpSession, new Soup.ProxyResolverDefault());
} else
_httpSession = new Soup.Session();
}
let here = this;
let message = Soup.form_request_new_from_hash('GET', url, params);

@ -65,9 +65,7 @@ const WEATHER_URL_BASE = 'http://api.openweathermap.org/data/2.5/';
const WEATHER_URL_CURRENT = WEATHER_URL_BASE + 'weather';
const WEATHER_URL_FIND = WEATHER_URL_BASE + 'find';
// Soup session (see https://bugzilla.gnome.org/show_bug.cgi?id=661323#c64) (Simon Legner)
const _httpSession = new Soup.SessionAsync();
Soup.Session.prototype.add_feature.call(_httpSession, new Soup.ProxyResolverDefault());
let _httpSession;
let mCities = null;
@ -544,6 +542,15 @@ const WeatherPrefsWidget = new GObject.Class({
},
loadJsonAsync: function(url, params, fun, id) {
if (_httpSession == undefined) {
if (ExtensionUtils.versionCheck(['3.6', '3.7'], Config.PACKAGE_VERSION)) {
// Soup session (see https://bugzilla.gnome.org/show_bug.cgi?id=661323#c64) (Simon Legner)
_httpSession = new Soup.SessionAsync();
Soup.Session.prototype.add_feature.call(_httpSession, new Soup.ProxyResolverDefault());
} else
_httpSession = new Soup.Session();
}
let here = this;
let message = Soup.form_request_new_from_hash('GET', url, params);

Loading…
Cancel
Save