Skip to content

Commit 3675ba7

Browse files
authored
Version 36 - hotfix (#126)
* fix issues flagged at review * add install script, fix fetch log
1 parent 294685b commit 3675ba7

File tree

7 files changed

+27
-21
lines changed

7 files changed

+27
-21
lines changed

buildzip.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ rm [email protected]
1919

2020
2121

22-
zip -d [email protected] screenshot/* screenshot buildzip.sh npm-debug.log icons/original/* .* translations.txt *.h package.json
22+
zip -d [email protected] screenshot/* screenshot *.sh npm-debug.log icons/original/* .* translations.txt *.h package.json *.po *.pot

carousel.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
const { Gtk, Gdk, GdkPixbuf, Gio, GLib } = imports.gi;
1111
const Me = imports.misc.extensionUtils.getCurrentExtension();
1212
const Utils = Me.imports.utils;
13-
const Lang = imports.lang;
1413

1514
const Convenience = Me.imports.convenience;
1615
const Gettext = imports.gettext.domain('BingWallpaper');

extension.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const Utils = Me.imports.utils;
2020
const Blur = Me.imports.blur;
2121
const Thumbnail = Me.imports.thumbnail;
2222
const BWClipboard = Me.imports.BWClipboard;
23-
//const Carousel = Me.imports.carousel;
2423
const Convenience = Me.imports.convenience;
2524
const Gettext = imports.gettext.domain('BingWallpaper');
2625
const _ = Gettext.gettext;
@@ -69,9 +68,6 @@ function doSetBackground(uri, schema) {
6968
return (prev != uri); // return true if background uri has changed
7069
}
7170

72-
let httpSession = new Soup.SessionAsync();
73-
Soup.Session.prototype.add_feature.call(httpSession, new Soup.ProxyResolverDefault());
74-
7571
const BingWallpaperIndicator = GObject.registerClass(
7672
class BingWallpaperIndicator extends PanelMenu.Button {
7773
_init(params = {}) {
@@ -101,6 +97,9 @@ class BingWallpaperIndicator extends PanelMenu.Button {
10197
// take a variety of actions when the gsettings values are modified by prefs
10298
this._settings = Utils.getSettings();
10399

100+
this.httpSession = new Soup.SessionAsync();
101+
Soup.Session.prototype.add_feature.call(this.httpSession, new Soup.ProxyResolverDefault());
102+
104103
getActorCompat(this).visible = !this._settings.get_boolean('hide');
105104

106105
// enable unsafe features on Wayland if the user overrides it
@@ -430,7 +429,7 @@ class BingWallpaperIndicator extends PanelMenu.Button {
430429
log("fetching: " + BingImageURL + (market != 'auto' ? market : ''));
431430

432431
// queue the http request
433-
httpSession.queue_message(request, function(httpSession, message) {
432+
this.httpSession.queue_message(request, function(httpSession, message) {
434433
if (message.status_code == 200) {
435434
let data = message.response_body.data;
436435
log("Recieved " + data.length + " bytes ");
@@ -653,7 +652,7 @@ class BingWallpaperIndicator extends PanelMenu.Button {
653652
});
654653

655654
// queue the http request
656-
httpSession.queue_message(request, function(httpSession, message) {
655+
this.httpSession.queue_message(request, function(httpSession, message) {
657656
// request completed
658657
fstream.close(null);
659658
that._updatePending = false;

install.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
4+
INSTALL_PATH=~/.local/share/gnome-shell/extensions
5+
6+
7+
./buildzip.sh
8+
9+
unzip -o $ZIP_NAME -d $INSTALL_PATH/$EXTENSION_NAME/

metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"name": "Bing Wallpaper",
55
"settings-schema": "org.gnome.shell.extensions.bingwallpaper",
66
"description": "Lightweight GNOME shell extension to set your wallpaper to today's Microsoft Bing image of the day (the image you see when you visit Bing.com).\n\n *Disclaimer*: this extension is unofficial and not affiliated with Bing or Microsoft in any way. Images are protected by copyright and are licensed only for use as wallpapers.\n\nThis extension is based extensively on the NASA APOD extension by Elinvention (https://github.com/Elinvention) and inspired by Bing Desktop Wallpaper Changer by Utkarsh Gupta (https://github.com/UtkarshGpta).\n\nFeatures:\n* Fetches Bing wallpaper of the day and sets as both lock screen and desktop wallpaper (user selectable on GNOME versions that support it)\n* Optionally force a specific region (i.e. locale)\n* UHD supported resolutions\n* Only attempts to download wallpapers when they have been updated\n* Doesn't poll continuously - only once per day and on startup (schedules a refresh when Bing is due to update)\n *NEW: random mode\n *NEW: select wallpaper from previously downloaded images\n* English (en), German (de), Dutch (nl), Italian (it), Polish (pl), Chinese (zh_CN), French (fr_FR), Portuguese (pt, pt_BR), Russian (ru_RU), Spanish (es), Korean (ko, ko_KR, ko_KP), Indonesian (id), Catalan (ca), Norwegian Bokmål (nb) & Nynorsk (ni), Swedish (sv), Arabic (ar), Hungarian (hu) and Finnish (fi_FI) - a HUGE thanks to the translators\n\nAlways restart GNOME after manually updating extensions. Please report bugs to the GitHub page below:",
7-
"version": "35",
7+
"version": "36",
88
"url": "https://github.com/neffo/bing-wallpaper-gnome-extension"
99
}

prefs.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77
// See the GNU General Public License, version 3 or later for details.
88
// Based on GNOME shell extension NASA APOD by Elia Argentieri https://github.com/Elinvention/gnome-shell-extension-nasa-apod
99

10-
const Gtk = imports.gi.Gtk;
11-
const Gdk = imports.gi.Gdk;
12-
const GdkPixbuf = imports.gi.GdkPixbuf;
13-
const Gio = imports.gi.Gio;
14-
const GLib = imports.gi.GLib;
10+
imports.gi.versions.Soup = '2.4';
11+
12+
const {Gtk, Gdk, GdkPixbuf, Gio, GLib, Soup} = imports.gi;
1513
const Me = imports.misc.extensionUtils.getCurrentExtension();
1614
const Utils = Me.imports.utils;
1715
const Convenience = Me.imports.convenience;
@@ -27,11 +25,11 @@ let lastreq = null;
2725
let provider = new Gtk.CssProvider();
2826

2927
let carousel = null;
28+
let httpSession = null;
3029

3130
const BingImageURL = Utils.BingImageURL;
3231

3332
function init() {
34-
settings = Utils.getSettings(Me);
3533
Convenience.initTranslations("BingWallpaper");
3634
}
3735

@@ -83,6 +81,10 @@ function buildPrefsWidget() {
8381
let buttonGDMdefault = buildable.get_object('button_default_gnome');
8482
let buttonnoblur = buildable.get_object('button_no_blur');
8583
let buttonslightblur = buildable.get_object('button_slight_blur');
84+
85+
settings = Utils.getSettings(Me);
86+
httpSession = new Soup.SessionAsync();
87+
Soup.Session.prototype.add_feature.call(httpSession, new Soup.ProxyResolverDefault());
8688

8789
// check that these are valid (can be edited through dconf-editor)
8890
//Utils.validate_market(settings, marketDescription);
@@ -230,7 +232,7 @@ function buildPrefsWidget() {
230232
box.show_all();
231233

232234
// fetch
233-
Utils.fetch_change_log(Me.metadata.version.toString(), change_log);
235+
Utils.fetch_change_log(Me.metadata.version.toString(), change_log, httpSession);
234236
lastreq = GLib.DateTime.new_now_utc();
235237

236238
return box;

utils.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ const Convenience = Me.imports.convenience;
1717
const Gettext = imports.gettext.domain('BingWallpaper');
1818
const _ = Gettext.gettext;
1919

20-
let httpSession = new Soup.SessionAsync();
21-
Soup.Session.prototype.add_feature.call(httpSession, new Soup.ProxyResolverDefault());
22-
2320
var PRESET_GNOME_DEFAULT = { blur: 60, dim: 55 }; // as at GNOME 40
2421
var PRESET_NO_BLUR = { blur: 0, dim: 60 };
2522
var PRESET_SLIGHT_BLUR = { blur: 2, dim: 60 };
@@ -130,7 +127,7 @@ function validate_imagename(settings) {
130127
}
131128
}
132129

133-
function validate_market(settings, marketDescription = null, lastreq = null) {
130+
function validate_market(settings, marketDescription = null, lastreq = null, httpSession) {
134131
let market = settings.get_string('market');
135132
if (market == "" || markets.indexOf(market) == -1) { // if not a valid market
136133
settings.reset('market');
@@ -175,7 +172,7 @@ function get_current_bg(schema) {
175172

176173
let gitreleaseurl = 'https://api.github.com/repos/neffo/bing-wallpaper-gnome-extension/releases/tags/';
177174

178-
function fetch_change_log(version, label) {
175+
function fetch_change_log(version, label, httpSession) {
179176
// create an http message
180177
let url = gitreleaseurl + "v" + version;
181178
let request = Soup.Message.new('GET', url);

0 commit comments

Comments
 (0)