Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 38 #144

Merged
merged 23 commits into from
Mar 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ Settings.ui.h
Settings4.ui.h
carousel.ui.h
carousel4.ui.h
test.js
4 changes: 2 additions & 2 deletions buildzip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ intltool-extract --type=gettext/glade ui/Settings.ui
intltool-extract --type=gettext/glade ui/Settings4.ui
intltool-extract --type=gettext/glade ui/carousel.ui
intltool-extract --type=gettext/glade ui/carousel4.ui
xgettext -k -k_ -kN_ -o locale/BingWallpaper.pot ui/Settings.ui.h ui/Settings4.ui.h ui/carousel.ui.h ui/carousel4.ui.h extension.js prefs.js blur.js utils.js convenience.js --from-code=UTF-8
xgettext -k -k_ -kN_ --omit-header -o locale/BingWallpaper.pot ui/Settings.ui.h ui/Settings4.ui.h ui/carousel.ui.h ui/carousel4.ui.h extension.js prefs.js blur.js utils.js convenience.js --from-code=UTF-8

echo "Translation status" > translations.txt
for D in locale/*; do
Expand All @@ -19,4 +19,4 @@ rm BingWallpaper@ineffable-gmail.com.zip

zip -r BingWallpaper@ineffable-gmail.com.zip *

zip -d BingWallpaper@ineffable-gmail.com.zip screenshot/* screenshot *.sh npm-debug.log icons/original/* .* translations.txt *.h package.json *.po *.pot
zip -d BingWallpaper@ineffable-gmail.com.zip screenshot/* screenshot *.sh npm-debug.log icons/original/* .* translations.txt *.h package.json *.po *.pot test.js
2 changes: 1 addition & 1 deletion convenience.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function versionSmaller(a, b) {
}

function currentVersion() {
return Config.PACKAGE_VERSION;
return ''+Config.PACKAGE_VERSION.replace(/(alpha|beta)/,'0');
}

function currentVersionEqual(v) {
Expand Down
46 changes: 28 additions & 18 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const MessageTray = imports.ui.messageTray;
const Util = imports.misc.util;
const PanelMenu = imports.ui.panelMenu;
const PopupMenu = imports.ui.popupMenu;
const ByteArray = imports.byteArray;

const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
Expand Down Expand Up @@ -59,6 +60,12 @@ function doSetBackground(uri, schema) {
let prev = gsettings.get_string('picture-uri');
uri = 'file://' + uri;
gsettings.set_string('picture-uri', uri);
try {
gsettings.set_string('picture-uri-dark', uri);
}
catch (e) {
log("unable to set dark background for : " + e);
}
Gio.Settings.sync();
gsettings.apply();
return (prev != uri); // return true if background uri has changed
Expand Down Expand Up @@ -93,8 +100,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.SessionAsync();
Soup.Session.prototype.add_feature.call(this.httpSession, new Soup.ProxyResolverDefault());
this.httpSession = new Soup.Session();

getActorCompat(this).visible = !this._settings.get_boolean('hide');

Expand Down Expand Up @@ -219,7 +225,7 @@ class BingWallpaperIndicator extends PanelMenu.Button {
_setImage() {
Utils.validate_imagename(this._settings);
this.selected_image = this._settings.get_string('selected-image');
log('selected image changed to :' + this.selected_image);
log('selected image changed to: ' + this.selected_image);
this._selectImage();
}

Expand All @@ -238,7 +244,7 @@ class BingWallpaperIndicator extends PanelMenu.Button {
let icon_name = this._settings.get_string('icon-name');
let gicon = Gio.icon_new_for_string(Me.dir.get_child('icons').get_path() + '/' + icon_name + '.svg');
this.icon = new St.Icon({gicon: gicon, style_class: 'system-status-icon'});
log('Replace icon set to : ' + icon_name);
log('Replace icon set to: ' + icon_name);
getActorCompat(this).remove_all_children();
getActorCompat(this).add_child(this.icon);
}
Expand Down Expand Up @@ -555,7 +561,7 @@ class BingWallpaperIndicator extends PanelMenu.Button {
}
else {
this.title = _("No wallpaper available");
this.explanation = _("No picture for today 😞.");
this.explanation = _("No picture for today.");
this.filename = "";
this._updatePending = false;
}
Expand Down Expand Up @@ -614,26 +620,30 @@ class BingWallpaperIndicator extends PanelMenu.Button {
// download and process new image
// FIXME: improve error handling
_downloadImage(url, file) {
log("Downloading " + url + " to " + file.get_uri());

let fstream = file.replace(null, false, Gio.FileCreateFlags.NONE, null);
log("Downloading " + url + " to " + file.get_uri());
let request = Soup.Message.new('GET', url);

// got_chunk event
request.connect('got_chunk', (message, chunk) => {
if (message.status_code == 200) { // only save the data we want, not content of 301 redirect page
fstream.write(chunk.get_data(), null);
}
});

// queue the http request
this.httpSession.queue_message(request, (httpSession, message) => {
// request completed
fstream.close(null);
this._updatePending = false;
if (message.status_code == 200) {
log('Download successful');
this._setBackground();
file.replace_contents_bytes_async(
message.response_body.flatten().get_as_bytes(),
null,
false,
Gio.FileCreateFlags.REPLACE_DESTINATION,
null,
(file, res) => {
try {
file.replace_contents_finish(res);
this._setBackground();
log('Download successful');
} catch(e) {
log('Error writing file: ' + e);
}
}
);
} else {
log('Couldn\'t fetch image from ' + url);
file.delete(null);
Expand Down
79 changes: 34 additions & 45 deletions locale/BingWallpaper.pot
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-14 18:32+1000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: ui/Settings.ui.h:1 ui/Settings4.ui.h:2
msgid "Hide the indicator"
msgstr ""
Expand All @@ -29,7 +10,7 @@ msgstr ""
msgid "Enable desktop notifications"
msgstr ""

#: ui/Settings.ui.h:4 ui/Settings4.ui.h:5 extension.js:118
#: ui/Settings.ui.h:4 ui/Settings4.ui.h:5 extension.js:124
msgid "Set background image"
msgstr ""

Expand Down Expand Up @@ -65,7 +46,7 @@ msgstr ""
msgid "Bing locale"
msgstr ""

#: ui/Settings.ui.h:13 ui/Settings4.ui.h:13 extension.js:121
#: ui/Settings.ui.h:13 ui/Settings4.ui.h:13 extension.js:127
msgid "Settings"
msgstr ""

Expand Down Expand Up @@ -207,8 +188,8 @@ msgstr ""

#: ui/Settings.ui.h:48 ui/Settings4.ui.h:47
msgid ""
"Show your support to the author on <a href=\"https://flattr.com/@neffo"
"\">Flattr</a> or <a href=\"https://github.com/sponsors/neffo\">Github "
"Show your support to the author on <a href=\"https://flattr.com/"
"@neffo\">Flattr</a> or <a href=\"https://github.com/sponsors/neffo\">Github "
"Sponsors</a>."
msgstr ""

Expand Down Expand Up @@ -259,86 +240,94 @@ msgstr ""
msgid "<image name here>"
msgstr ""

#: extension.js:106
#: extension.js:112
msgid "<No refresh scheduled>"
msgstr ""

#: extension.js:108 extension.js:110 extension.js:113
#: extension.js:114 extension.js:116 extension.js:119
msgid "Awaiting refresh..."
msgstr ""

#: extension.js:115
#: extension.js:121
msgid "Copy image to clipboard"
msgstr ""

#: extension.js:116
#: extension.js:122
msgid "Copy image URL to clipboard"
msgstr ""

#: extension.js:117
#: extension.js:123
msgid "Open image folder"
msgstr ""

#: extension.js:119
#: extension.js:125
msgid "Set lock screen image"
msgstr ""

#: extension.js:120
#: extension.js:126
msgid "Refresh Now"
msgstr ""

#: extension.js:209
#: extension.js:215
msgid "Next refresh"
msgstr ""

#: extension.js:505 extension.js:532
#: extension.js:511 extension.js:538
msgid "Bing Wallpaper of the Day for"
msgstr ""

#: extension.js:557
#: extension.js:563
msgid "No wallpaper available"
msgstr ""

#: extension.js:558
msgid "No picture for today 😞."
#: extension.js:564
msgid "No picture for today."
msgstr ""

#: prefs.js:202
#: prefs.js:172
msgid "Select folder"
msgstr ""

#: prefs.js:237
msgid "Most recent image"
msgstr ""

#: prefs.js:203
#: prefs.js:238
msgid "Random image"
msgstr ""

#: utils.js:118
#: utils.js:116
msgid "Fetching data..."
msgstr ""

#: utils.js:129
#: utils.js:127
msgid "Market not available in your region"
msgstr ""

#: utils.js:133
#: utils.js:131
msgid "A network error occured"
msgstr ""

#: utils.js:138
#: utils.js:136
msgid "Too many requests in 5 seconds"
msgstr ""

#: utils.js:163
#: utils.js:162
msgid "No change log found for this release"
msgstr ""

#: utils.js:366 utils.js:369
#: utils.js:168
msgid "Error fetching change log"
msgstr ""

#: utils.js:379 utils.js:382
msgid "minutes"
msgstr ""

#: utils.js:372
#: utils.js:385
msgid "days"
msgstr ""

#: utils.js:375
#: utils.js:388
msgid "hours"
msgstr ""
Binary file modified locale/ar/LC_MESSAGES/BingWallpaper.mo
Binary file not shown.