Skip to content

Commit

Permalink
Version 38 (#144)
Browse files Browse the repository at this point in the history
* Updated German, Italian and Arabic translation (#142) #14
* add gettext domain to metadata
* safer and more reliable method for _downloadImage #145
* move download folder fix #106
* set gtk4 filechooser button label #151
* better deal with home dir changes #151
* migrate from deprecated Soup.SessionAsync #150
* handle failures to get a httpsession #150
* change log error shouldn't stop prefs opening #150
* support GNOME 42, set dark style background #153 #154
* merge changes from #148
* improve user directory handling, remove '😞' char #151
* better default pref window size on gnome 40+ #147
* disable gallery, and open gallery fall back to open folder
* bump version to version 38

Co-authored-by: JAKuhr <9527705+JAKuhr@users.noreply.github.com>
Co-authored-by: Simone Dotto <simonedotto@protonmail.com>
Co-authored-by: Amro Soliman <81815707+amrosolaiman@users.noreply.github.com>
  • Loading branch information
4 people committed Mar 19, 2022
1 parent 81a2f5c commit fc03e48
Show file tree
Hide file tree
Showing 66 changed files with 624 additions and 431 deletions.
1 change: 1 addition & 0 deletions .gitignore
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
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
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
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
@@ -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.

0 comments on commit fc03e48

Please sign in to comment.