diff --git a/extension.js b/extension.js index 31730bf7..7f090b2f 100644 --- a/extension.js +++ b/extension.js @@ -115,13 +115,7 @@ class BingWallpaperIndicator extends PanelMenu.Button { // take a variety of actions when the gsettings values are modified by prefs this._settings = ExtensionUtils.getSettings(Utils.BING_SCHEMA); - this.httpSession = new Soup.Session(); - Soup.Session.prototype.add_feature.call(this.httpSession, new Soup.ProxyResolverDefault()); // unclear if this is necessary - if (this._settings.get_boolean('debug-logging')) { - this.logger = Soup.Logger.new(Soup.LoggerLogLevel.HEADERS, -1); - this.logger.attach(this.httpSession); - this.logger.set_printer(soupPrinter); - } + this._initSoup(); getActorCompat(this).visible = !this._settings.get_boolean('hide'); @@ -218,6 +212,16 @@ class BingWallpaperIndicator extends PanelMenu.Button { } } + _initSoup() { + this.httpSession = new Soup.Session(); + Soup.Session.prototype.add_feature.call(this.httpSession, new Soup.ProxyResolverDefault()); // unclear if this is necessary + if (this._settings.get_boolean('debug-logging')) { + this.logger = Soup.Logger.new(Soup.LoggerLogLevel.HEADERS, -1); + this.logger.attach(this.httpSession); + this.logger.set_printer(soupPrinter); + } + } + // listen for configuration changes _setConnections() { this._settings.connect('changed::hide', () => { @@ -487,6 +491,7 @@ class BingWallpaperIndicator extends PanelMenu.Button { this._updatePending = true; this._restartTimeout(); let market = this._settings.get_string('market'); + this._initSoup(); // get new session, incase we aren't detecting proxy changes // create an http message let url = BingImageURL + (market != 'auto' ? market : ''); let request = Soup.Message.new('GET', url);