diff --git a/blur.js b/blur.js index fcf090b4..e063be6e 100644 --- a/blur.js +++ b/blur.js @@ -33,7 +33,7 @@ var promptActive = false; // default GNOME method of testing this relies on st function log(msg) { if (debug) // set 'debug' above to false to keep the noise down in journal - print("BingWallpaper extension/Blur: " + msg); + console.log("BingWallpaper extension/Blur: " + msg); } // we patch UnlockDialog._updateBackgroundEffects() diff --git a/carousel.js b/carousel.js index 3685ea7b..c673b142 100644 --- a/carousel.js +++ b/carousel.js @@ -107,9 +107,8 @@ export default class Carousel { deleteButton.connect('clicked', (widget) => { this.log('Delete requested for '+filename); Utils.deleteImage(filename); - //Utils.cleanupImageList(this.settings); + //Utils.cleanupImageList(this.settings); // hide image instead Utils.hideImage(this.settings, [image]); - Utils.cleanupImageList(this.settings); widget.get_parent().get_parent().set_visible(false); // bit of a hack if (this.callbackfunc) this.callbackfunc(); @@ -224,6 +223,6 @@ export default class Carousel { log(msg) { if (this.settings.get_boolean('debug-logging')) - print("BingWallpaper extension: " + msg); // disable to keep the noise down in journal + console.log("BingWallpaper extension: " + msg); // disable to keep the noise down in journal } }; \ No newline at end of file diff --git a/extension.js b/extension.js index 9164ffe5..e286d0f9 100644 --- a/extension.js +++ b/extension.js @@ -34,15 +34,8 @@ const TIMEOUT_SECONDS = 24 * 3600; // FIXME: this should use the end data from t const TIMEOUT_SECONDS_ON_HTTP_ERROR = 1 * 3600; // retry in one hour if there is a http error3 const MINIMUM_SHUFFLE_IMAGES = 3; // bare minimum to use filtered image set in shuffle mode const ICON_PREVIOUS_BUTTON = 'media-seek-backward-symbolic'; -const ICON_SHUFFLE_BUTTON = 'media-playlist-shuffle-symbolic'; -const ICON_CONSEC_BUTTON = 'media-playlist-consecutive-symbolic'; const ICON_NEXT_BUTTON = 'media-seek-forward-symbolic'; const ICON_CURRENT_BUTTON = 'media-skip-forward-symbolic'; -const ICON_TIMED_MODE_BUTTON = 'document-open-recent-symbolic'; -const ICON_PAUSE_MODE_BUTTON = 'media-playback-pause-symbolic'; -const ICON_PLAY_MODE_BUTTON = 'media-playback-start-symbolic'; -const ICON_REFRESH = 'view-refresh-symbolic'; -const ICON_RANDOM = 'game-die-symbolic.svg'; let bingWallpaperIndicator = null; let blur = null; @@ -116,7 +109,7 @@ class BingWallpaperIndicator extends Button { this.dimensions = { 'width': null, 'height': null}; this._extension = ext; - let extensionIconsPath = ext.dir.get_child('icons').get_path() + let extensionIconsPath = ext.dir.get_child('icons').get_path(); this.ICON_RANDOM = extensionIconsPath + '/'+'game-die-symbolic.svg'; this.ICON_FAVE_BUTTON = extensionIconsPath + '/'+'fav-symbolic.svg'; this.ICON_UNFAVE_BUTTON = extensionIconsPath + '/'+'unfav-symbolic.svg'; @@ -135,7 +128,6 @@ class BingWallpaperIndicator extends Button { this.visible = !this._settings.get_boolean('hide'); this.refreshDueItem = newMenuItem(_("")); - this.titleItem = new PopupMenu.PopupSubMenuMenuItem(_("Awaiting refresh..."), false); this.explainItem = newMenuItem(_("Awaiting refresh...")); this.copyrightItem = newMenuItem(_("Awaiting refresh...")); this.clipboardImageItem = newMenuItem(_("Copy image to clipboard")); @@ -147,8 +139,10 @@ class BingWallpaperIndicator extends Button { this.settingsItem = newMenuItem(_("Settings")); this.openImageItem = newMenuItem(_("Open in image viewer")); this.openImageInfoLinkItem = newMenuItem(_("Open Bing image information page")); + this.imageResolutionItem = newMenuItem(_("Awaiting refresh...")); - [this.openImageInfoLinkItem, this.openImageItem, this.folderItem, + this.titleItem = new PopupMenu.PopupSubMenuMenuItem(_("Awaiting refresh..."), false); + [this.imageResolutionItem, this.openImageInfoLinkItem, this.openImageItem, this.folderItem, this.clipboardImageItem, this.clipboardURLItem, this.dwallpaperItem] .forEach(e => this.titleItem.menu.addMenuItem(e)); @@ -161,9 +155,10 @@ class BingWallpaperIndicator extends Button { this.toggleShuffleOnlyFaves = newMenuSwitchItem(_("Image shuffle only favourites"), this._settings.get_boolean('random-mode-include-only-favourites')); this.toggleNotifications = newMenuSwitchItem(_("Enable desktop notifications"), this._settings.get_boolean('notify')); this.toggleImageCount = newMenuSwitchItem(_("Show image count"), this._settings.get_boolean('show-count-in-image-title')); + this.toggleShuffleOnlyUHD = newMenuSwitchItem(_("Image shuffle only UHD resolutions"), this._settings.get_boolean('random-mode-include-only-uhd')); - [this.toggleNotifications, this.toggleImageCount, this.toggleSetBackground, this.toggleSelectNew, - this.toggleShuffle, this.toggleShuffleOnlyFaves] + [this.toggleNotifications, /*this.toggleImageCount, this.toggleSetBackground,*/ this.toggleSelectNew, + this.toggleShuffle, this.toggleShuffleOnlyFaves, this.toggleShuffleOnlyUHD] .forEach(e => this.settingsSubMenu.menu.addMenuItem(e)); // these items are a bit unique, we'll populate them in _setControls() @@ -195,11 +190,18 @@ class BingWallpaperIndicator extends Button { allMenuItems.forEach(e => this.menu.addMenuItem(e)); // non clickable information items - [this.explainItem, this.copyrightItem, this.refreshDueItem, this.thumbnailItem] + [this.explainItem, this.copyrightItem, this.refreshDueItem, this.thumbnailItem, this.imageResolutionItem] .forEach((e) => { e.setSensitive(false); }); + if (this._settings.get_boolean('random-mode-enabled')) { + [this.toggleShuffleOnlyFaves, this.toggleShuffleOnlyUHD] + .forEach((e) => { + e.setSensitive(false); + }); + } + this._setConnections(); if (this._settings.get_string('state') != '[]') { // setting state on reset or initial boot @@ -226,14 +228,18 @@ class BingWallpaperIndicator extends Button { {signal: 'changed::icon-name', call: this._setIcon}, {signal: 'changed::market', call: this._refresh}, {signal: 'changed::set-background', call: this._setBackground}, - /*{signal: 'changed::set-lockscreen', call: this._setBackground},*/ {signal: 'changed::override-lockscreen-blur', call: this._setBlur}, {signal: 'changed::selected-image', call: this._setImage}, {signal: 'changed::delete-previous', call: this._cleanUpImages}, {signal: 'changed::notify', call: this._notifyCurrentImage}, {signal: 'changed::always-export-bing-json', call: this._exportData}, {signal: 'changed::bing-json', call: this._exportData}, - {signal: 'changed::controls-icon-size', call: this._setControls} + {signal: 'changed::controls-icon-size', call: this._setControls}, + {signal: 'changed::random-mode-enabled', call: this._randomModeChanged}, + {signal: 'changed::random-mode-include-only-favourites', call: this._randomModeChanged}, + {signal: 'changed::random-mode-include-only-unhidden', call: this._randomModeChanged}, + {signal: 'changed::random-mode-include-only-uhd', call: this._randomModeChanged}, + {signal: 'changed::random-interval-mode', call: this._randomModeChanged} ]; // _setShuffleToggleState @@ -263,43 +269,27 @@ class BingWallpaperIndicator extends Button { this.refreshItem.connect('activate', this._refresh.bind(this)); this.settingsItem.connect('activate', this._openPrefs.bind(this)); - // unfortunately we can't bind like we can with prefs here, so we handle toggles in two steps - // first, we listen for changes to these toggle settings and update toggles - this._settings.connect('changed::set-background', () => { - this.toggleSetBackground.setToggleState(this._settings.get_boolean('set-background')); - }); - this._settings.connect('changed::revert-to-current-image', () => { - this.toggleSelectNew.setToggleState(this._settings.get_boolean('revert-to-current-image')); - }); - this._settings.connect('changed::notify', () => { - this.toggleNotifications.setToggleState(this._settings.get_boolean('notify')); - }); - this._settings.connect('changed::show-count-in-image-title', () => { - this.toggleImageCount.setToggleState(this._settings.get_boolean('show-count-in-image-title')); - this._setMenuText(); - }); - - // & then, link settings to toggle state (the other way) - this.toggleSetBackground.connect('toggled', (item, state) => { - this._settings.set_boolean('set-background', state); - }); - this.toggleSelectNew.connect('toggled', (item, state) => { - this._settings.set_boolean('revert-to-current-image', state); - }); - this.toggleNotifications.connect('toggled', (item, state) => { - this._settings.set_boolean('notify', state); - }); - this.toggleImageCount.connect('toggled', (item, state) => { - this._settings.set_boolean('show-count-in-image-title', state); - this._selectImage(false); - }); - this.toggleShuffleOnlyFaves.connect('toggled', (item, state) => { - this._settings.set_boolean('random-mode-include-only-favourites', state); - }); + // unfortunately we can't bind toggles trivially like we can with prefs.js here, so we handle toggles in two steps + // first, we listen for changes to these toggle settings and update the status + // & then, link settings to toggle state (the other way) + + let toggles = [ /*{key: 'set-background', toggle: this.toggleSetBackground},*/ + {key: 'revert-to-current-image', toggle: this.toggleSelectNew}, + {key: 'notify', toggle: this.toggleNotifications}, + /*{key: 'show-count-in-image-title', toggle: this.toggleImageCount},*/ + {key: 'random-mode-enabled', toggle: this.toggleShuffle}, + {key: 'random-mode-include-only-favourites', toggle: this.toggleShuffleOnlyFaves}, + /*{key: 'random-mode-include-only-unhidden', toggle: this.toggleShuffleOnlyUnhidden},*/ + {key: 'random-mode-include-only-uhd', toggle: this.toggleShuffleOnlyUHD}]; - // shuffle is a special case - this._setShuffleToggleState(); - this.toggleShuffle.connect('toggled', this._toggleShuffle.bind(this)); + toggles.forEach( (e) => { + this._settings.connect('changed::'+e.key, () => { + e.toggle.setToggleState(this._settings.get_boolean(e.key)); + }); + e.toggle.connect('toggled', (item, state) => { + this._settings.set_boolean(e.key, state); + }); + }); this.folderItem.connect('activate', Utils.openImageFolder.bind(this, this._settings)); if (this.clipboard.clipboard) { // only if we have a clipboard @@ -328,9 +318,16 @@ class BingWallpaperIndicator extends Button { this.titleItem.setSensitive(!this._updatePending && this.imageinfolink != ""); let maxlongdate = Utils.getMaxLongDate(this._settings); this.refreshduetext = - _("Next refresh") + ": " + (this.refreshdue ? this.refreshdue.format("%Y-%m-%d %X") : '-') + " (" + Utils.friendly_time_diff(this.refreshdue) + ")\n" + + _("Next refresh") + ": " + (this.refreshdue ? this.refreshdue.format("%Y-%m-%d %X") : '-') + + " (" + Utils.friendly_time_diff(this.refreshdue) + ")\n" + _("Last refresh") + ": " + (maxlongdate? this._localeDate(maxlongdate, true) : '-'); - this.refreshDueItem.label.set_text(this.refreshduetext); + // also show when shuffle is next due + if (this._settings.get_boolean('random-mode-enabled')) { + this.refreshduetext += "\n" + _("Next shuffle")+": " + + (this.shuffledue ? this.shuffledue.format("%Y-%m-%d %X") : '-') + + " (" + Utils.friendly_time_diff(this.shuffledue) + ")"; + } + this.refreshDueItem.label.set_text(this.refreshduetext); } _setBlur() { @@ -344,7 +341,7 @@ class BingWallpaperIndicator extends Button { this.selected_image = this._settings.get_string('selected-image'); log('selected image changed to: ' + this.selected_image); this._selectImage(); - this._setShuffleToggleState(); + //this._setShuffleToggleState(); } _notifyCurrentImage() { @@ -378,18 +375,11 @@ class BingWallpaperIndicator extends Button { log('image set to : '+this.filename); if (this._settings.get_boolean('set-background')) this._setBackgroundDesktop(); - - if (this._settings.get_boolean('set-lock-screen')) - this._setBackgroundScreensaver(); } _setBackgroundDesktop() { doSetBackground(this.filename, Utils.DESKTOP_SCHEMA); } - - _setBackgroundScreensaver() { - doSetBackground(this.filename, Utils.LOCKSCREEN_SCHEMA); - } _copyURLToClipboard() { this.clipboard.setText(this.imageURL); @@ -440,6 +430,7 @@ class BingWallpaperIndicator extends Button { _setMenuText() { this.titleItem.label.set_text(this.title ? this.title : ''); this.copyrightItem.label.set_text(this.copyright ? this.copyright : ''); + this.imageResolutionItem.label.set_text(this.dimensions.width+'px x '+this.dimensions.height+'px'); if (this._settings.get_boolean('show-count-in-image-title') && this.explanation) { let imageList = JSON.parse(this._settings.get_string('bing-json')); if (imageList.length > 0) @@ -449,6 +440,7 @@ class BingWallpaperIndicator extends Button { this.explainItem.label.set_text(this.explanation ? this.explanation : ''); } this._setFavouriteIcon(this.favourite_status?this.ICON_FAVE_BUTTON:this.ICON_UNFAVE_BUTTON); + this._setTrashIcon(this.hidden_status?this.ICON_UNTRASH_BUTTON:this.ICON_TRASH_BUTTON); } _wrapLabelItem(menuItem) { @@ -464,6 +456,10 @@ class BingWallpaperIndicator extends Button { this.favourite_status?this.ICON_FAVE_BUTTON:this.ICON_UNFAVE_BUTTON, this.controlItem, this._favouriteImage); + this.trashBtn = this._newMenuIcon( + this.hidden_status?this.ICON_UNTRASH_BUTTON:this.ICON_TRASH_BUTTON, + this.controlItem, + this._trashImage); this.prevBtn = this._newMenuIcon( ICON_PREVIOUS_BUTTON, this.controlItem, @@ -479,7 +475,7 @@ class BingWallpaperIndicator extends Button { this.randomizeBtn = this._newMenuIcon( this.ICON_RANDOM, this.controlItem, - this._shuffleImage, + this._selectImage, null, true); } @@ -563,27 +559,23 @@ class BingWallpaperIndicator extends Button { this._gotoImage(0); } - _shuffleImage() { - this._selectImage(true); - } - - _setShuffleToggleState() { - this.toggleShuffle.setToggleState(this._settings.get_string('selected-image') == 'random'); - } - - _toggleShuffleOnlyFaves() { - - } - - _toggleShuffle() { - if (this._settings.get_string('selected-image') == 'random') { - this._settings.set_string('selected-image', 'current'); + _randomModeChanged() { + let randomEnabled = this._settings.get_boolean('random-mode-enabled'); + [this.toggleShuffleOnlyFaves, this.toggleShuffleOnlyUHD /*, this.toggleShuffleOnlyUnhidden*/] + .forEach( x => { + x.setSensitive(randomEnabled); + }); + if (randomEnabled) { + log('enabled shuffle mode, by setting a shuffe timer (5 seconds)'); + this._restartShuffleTimeout(5); + this._settings.set_boolean('revert-to-current-image', false); } else { - this._settings.set_string('selected-image', 'random'); + // clear shuffle timer + if (this._shuffleTimeout) + GLib.source_remove(this._shuffleTimeout); + this._settings.set_boolean('revert-to-current-image', true); } - this._setShuffleToggleState(); - log('switched mode to ' + this._settings.get_string('selected-image')); } _favouriteImage() { @@ -593,6 +585,13 @@ class BingWallpaperIndicator extends Button { this._setFavouriteIcon(this.favourite_status?this.ICON_FAVE_BUTTON:this.ICON_UNFAVE_BUTTON); } + _trashImage() { + log('trash image '+this.imageURL+' status was '+this.hidden_status); + this.hidden_status = !this.hidden_status; + Utils.setImageHiddenStatus(this._settings, [this.imageURL], this.hidden_status); + this._setTrashIcon(this.hidden_status?ICON_UNTRASH_BUTTON:ICON_TRASH_BUTTON); + } + _setFavouriteIcon(icon_name) { let gicon = Gio.icon_new_for_string(icon_name); this.favouriteBtn.get_children().forEach( (x, i) => { @@ -600,13 +599,17 @@ class BingWallpaperIndicator extends Button { }); } + _setTrashIcon(icon_name) { + let gicon = Gio.icon_new_for_string(icon_name); + this.trashBtn.get_children().forEach( (x, i) => { + x.set_gicon(gicon); + }); + } + _gotoImage(relativePos) { let imageList = Utils.getImageList(this._settings); let curIndex = 0; - if (this.selected_image == 'random') - return; - if (this.selected_image == 'current') { curIndex = Utils.getCurrentImageIndex(imageList); } @@ -679,7 +682,7 @@ class BingWallpaperIndicator extends Button { log('Recieved ' + data.length + ' bytes'); this._parseData(data); - if (this.selected_image != 'random') + if (!this._settings.get_boolean('random-mode-enabled')) this._selectImage(); } catch (error) { @@ -698,19 +701,35 @@ class BingWallpaperIndicator extends Button { seconds = TIMEOUT_SECONDS; this._timeout = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, seconds, this._refresh.bind(this)); - let localTime = GLib.DateTime.new_now_local().add_seconds(seconds); - this.refreshdue = localTime; - log('next check in ' + seconds + ' seconds @ local time ' + localTime.format('%F %R %z')); + this.refreshdue = GLib.DateTime.new_now_local().add_seconds(seconds); + log('next check in ' + seconds + ' seconds'); } _restartShuffleTimeout(seconds = null) { + log('_restartShuffleTimeout('+seconds+')'); + //console.trace(); + if (this._shuffleTimeout) GLib.source_remove(this._shuffleTimeout); - if (seconds == null) - seconds = this._settings.get_int('random-interval'); + if (seconds == null) { + let diff = -Math.floor(GLib.DateTime.new_now_local().difference(this.shuffledue)/1000000); + log('shuffle ('+this.shuffledue.format_iso8601()+') diff = '+diff); + if (diff > 0) { + seconds = diff; // if not specified, we should maintain the existing shuffle timeout (i.e. we just restored from saved state) + } + else if (this._settings.get_string('random-interval-mode') != 'custom') { + let random_mode = this._settings.get_string('random-interval-mode'); + seconds = Utils.seconds_until(random_mode); // else we shuffle at specified interval (midnight default) + log('shuffle mode = '+random_mode+' = '+seconds+' from now'); + } + else { + seconds = this._settings.get_int('random-interval'); // or whatever the user has specified (as a timer) + } + } - this._shuffleTimeout = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, seconds, this._selectImage.bind(this)); + this._shuffleTimeout = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, seconds, this._selectImage.bind(this, true)); + this.shuffledue = GLib.DateTime.new_now_local().add_seconds(seconds); log('next shuffle in ' + seconds + ' seconds'); } @@ -733,7 +752,9 @@ class BingWallpaperIndicator extends Button { log('WARNING: Bing returning market data for ' + datamarket + ' rather than selected ' + prefmarket); Utils.purgeImages(this._settings); // delete older images if enabled - Utils.cleanupImageList(this._settings); + //Utils.cleanupImageList(this._settings); // disabled, as old images should still be downloadble in theory + this._downloadAllImages(); // fetch missing images that are still available + Utils.populateImageListResolutions(this._settings); if (newImages.length > 0 && this._settings.get_boolean('revert-to-current-image')) { // user wants to switch to the new image when it arrives @@ -743,7 +764,7 @@ class BingWallpaperIndicator extends Button { if (this._settings.get_boolean('notify')) { if (!this._settings.get_boolean('notify-only-latest')) { // notify all new images - newImages.forEach((image, index) => { + newImages.forEach((image) => { log('New image to notify: ' + Utils.getImageTitle(image)); this._createNotification(image); }); @@ -762,7 +783,8 @@ class BingWallpaperIndicator extends Button { this._updatePending = false; } catch (error) { - log('_parseData() failed with error ' + error); + log('_parseData() failed with error ' + error + ' @ '+error.lineNumber); + log(error.stack); } } @@ -783,31 +805,62 @@ class BingWallpaperIndicator extends Button { source.showNotification(notification); } + _shuffleImage() { + let image = null; + let imageList = Utils.getImageList(this._settings); + let filter = { 'faves': this._settings.get_boolean('random-mode-include-only-favourites'), + 'hidden': this._settings.get_boolean('random-mode-include-only-unhidden'), + 'min_height': this._settings.get_boolean('random-mode-include-only-uhd')?this._settings.get_int('min-uhd-height'):false + }; + let favImageList = Utils.getImageList(this._settings, filter); + + if (favImageList.length >= MINIMUM_SHUFFLE_IMAGES) { // we have the minimum images to shuffle, if not fall back to shuffle all iamges + imageList = favImageList; + } + else { + log('not enough filtered images available to shuffle'); + } + + // shuffle could fail for a number of reasons + try { + this.imageIndex = Utils.getRandomInt(imageList.length); + image = imageList[this.imageIndex]; + + log('shuffled to image '+image.urlbase); + + return image; + } + catch (e) { + log('shuffle failed '+e); + return null; + } + } + _selectImage(force_shuffle = false) { let imageList = Utils.getImageList(this._settings); let image = null; // special values, 'current' is most recent (default mode), 'random' picks one at random, anything else should be filename - if (this.selected_image == 'random' || force_shuffle) { - if (this._settings.get_boolean('random-mode-include-only-favourites')) { - let favImageList = imageList.filter(Utils.isFavourite); - if (favImageList.length > 0) - imageList = favImageList; - else - log('not enough favourites available to shuffle'); - } - this.imageIndex = Utils.getRandomInt(imageList.length); - image = imageList[this.imageIndex]; - this._restartShuffleTimeout(); - } else if (this.selected_image == 'current') { - image = Utils.getCurrentImage(imageList); - this.imageIndex = Utils.getCurrentImageIndex(imageList); - } else { - image = Utils.inImageList(imageList, this.selected_image); - log('_selectImage: ' + this.selected_image + ' = ' + image ? image.urlbase : 'not found'); - if (!image) // if we didn't find it, try for current + if (force_shuffle) { + image = this._shuffleImage(); + if (this._settings.get_boolean('random-mode-enabled')) + this._restartShuffleTimeout(); + } + + if (!image) { + if (this.selected_image == 'current') { image = Utils.getCurrentImage(imageList); - this.imageIndex = Utils.imageIndex(imageList, image.urlbase); + this.imageIndex = Utils.getCurrentImageIndex(imageList); + } else { + image = Utils.inImageList(imageList, this.selected_image); + + if (!image) // if we didn't find it, try for current + image = Utils.getCurrentImage(imageList); + + if (image) + this.imageIndex = Utils.imageIndex(imageList, image.urlbase); + log('_selectImage: ' + this.selected_image + ' = ' + (image && image.urlbase) ? image.urlbase : 'not found'); + } } if (!image) @@ -823,8 +876,12 @@ class BingWallpaperIndicator extends Button { this.copyright = image.copyright.match(/[\(\(]([^)]+)[\)\)]/)[1].replace('\*\*', ''); // Japan locale uses () rather than () this.longstartdate = image.fullstartdate; this.imageinfolink = image.copyrightlink.replace(/^http:\/\//i, 'https://'); - this.imageURL = BingURL + image.urlbase + '_' + resolution + '.jpg'; // generate image url for user's resolution - this.filename = toFilename(BingWallpaperDir, image.startdate, image.urlbase, resolution); + this.imageURL = BingURL + image.urlbase + '_' + resolution + '.jpg'+'&qlt=100'; // generate image url for user's resolution @ high quality + this.filename = Utils.toFilename(BingWallpaperDir, image.startdate, image.urlbase, resolution); + this.dimensions.width = image.width?image.width:null; + this.dimensions.height = image.height?image.height:null; + this.selected_image = Utils.getImageUrlBase(image); + this._settings.set_string('selected-image', this.selected_image); if (("favourite" in image) && image.favourite === true ) { this.favourite_status = true; @@ -832,17 +889,20 @@ class BingWallpaperIndicator extends Button { else { this.favourite_status = false; } + + if (("hidden" in image) && image.hidden === true ) { + this.hidden_status = true; + } + else { + this.hidden_status = false; + } let file = Gio.file_new_for_path(this.filename); let file_exists = file.query_exists(null); let file_info = file_exists ? file.query_info ('*', Gio.FileQueryInfoFlags.NONE, null) : 0; if (!file_exists || file_info.get_size () == 0) { // file doesn't exist or is empty (probably due to a network error) - let dir = Gio.file_new_for_path(BingWallpaperDir); - if (!dir.query_exists(null)) { - dir.make_directory_with_parents(null); - } - this._downloadImage(this.imageURL, file); + this._downloadImage(this.imageURL, file, true); } else { this._setBackground(); @@ -860,12 +920,19 @@ class BingWallpaperIndicator extends Button { this._storeState(); } + _imageURL(urlbase, resolution) { + return BingURL + urlbase + '_' + resolution + '.jpg'; + } + _storeState() { if (this.filename) { let maxLongDate = Utils.getMaxLongDate(this._settings); // refresh date from most recent Bing image let state = {maxlongdate: maxLongDate, title: this.title, explanation: this.explanation, copyright: this.copyright, longstartdate: this.longstartdate, imageinfolink: this.imageinfolink, imageURL: this.imageURL, - filename: this.filename, favourite: this.favourite_status}; + filename: this.filename, favourite: this.favourite_status, width: this.dimensions.width, + height: this.dimensions.height, + shuffledue: (this.shuffledue.to_unix? this.shuffledue.to_unix():0) + }; let stateJSON = JSON.stringify(state); log('Storing state as JSON: ' + stateJSON); @@ -890,13 +957,11 @@ class BingWallpaperIndicator extends Button { this.imageinfolink = state.imageinfolink; this.imageURL = state.imageURL; this.filename = state.filename; + this.dimensions.width = state.width; + this.dimensions.height = state.height; this._selected_image = this._settings.get_string('selected-image'); - if ("favourite" in state && state.favourite === true) { - this.favourite_status = true; - } - else { - this.favourite_status = false; - } + this.shuffledue = ("shuffledue" in state)? GLib.DateTime.new_from_unix_local(state.shuffledue) : 0; + this.favourite_status = ("favourite" in state && state.favourite === true); // update menus and thumbnail this._setMenuText(); this._setBackground(); @@ -906,8 +971,9 @@ class BingWallpaperIndicator extends Button { return; } - if (this.selected_image == 'random') { - this._shuffleImage(); + if (this._settings.get_boolean('random-mode-enabled')) { + log('random mode enabled, restarting random state'); + this._restartShuffleTimeoutFromDueDate(this.shuffledue); // FIXME: use state value this._restartTimeoutFromLongDate(maxLongDate); } else { @@ -922,9 +988,27 @@ class BingWallpaperIndicator extends Button { this._restartTimeout(60); } + _downloadAllImages() { + // fetch recent undownloaded images + let imageList = Utils.getFetchableImageList(this._settings); + let BingWallpaperDir = Utils.getWallpaperDir(this._settings); + imageList.forEach( (image) => { + let resolution = Utils.getResolution(this._settings, image); + let filename = Utils.toFilename(BingWallpaperDir, image.startdate, image.urlbase, resolution); + let url = this._imageURL(image.urlbase, resolution); + let file = Gio.file_new_for_path(filename); + this._downloadImage(url, file, false); + }); + } + // download and process new image // FIXME: improve error handling - _downloadImage(url, file) { + _downloadImage(url, file, set_background) { + let BingWallpaperDir = Utils.getWallpaperDir(this._settings); + let dir = Gio.file_new_for_path(BingWallpaperDir); + if (!dir.query_exists(null)) { + dir.make_directory_with_parents(null); + } log("Downloading " + url + " to " + file.get_uri()); let request = Soup.Message.new('GET', url); @@ -932,26 +1016,21 @@ class BingWallpaperIndicator extends Button { try { if (Soup.MAJOR_VERSION >= 3) { this.httpSession.send_and_read_async(request, GLib.PRIORITY_DEFAULT, null, (httpSession, message) => { - // request completed - this._updatePending = false; - this._processFileDownload(message, file); + this._processFileDownload(message, file, set_background); }); } else { this.httpSession.queue_message(request, (httpSession, message) => { - // request completed - this._updatePending = false; - this._processFileDownload(message, file); + this._processFileDownload(message, file, set_background); }); } - } catch (error) { log('error sending libsoup message '+error); } } - _processFileDownload(message, file) { + _processFileDownload(message, file, set_background) { try { let data = (Soup.MAJOR_VERSION >= 3) ? this.httpSession.send_and_read_finish(message).get_data(): @@ -966,7 +1045,8 @@ class BingWallpaperIndicator extends Button { (file, res) => { try { file.replace_contents_finish(res); - this._setBackground(); + if (set_background) + this._setBackground(); log('Download successful'); } catch(e) { @@ -1001,6 +1081,8 @@ class BingWallpaperIndicator extends Button { this._timeout = undefined; this._shuffleTimeout = undefined; this.menu.removeAll(); + blur._disable(); // disable blur (blur.js) override and cleanup + blur = null; } }); diff --git a/locale/BingWallpaper.pot b/locale/BingWallpaper.pot index 21c5851a..f356658d 100644 --- a/locale/BingWallpaper.pot +++ b/locale/BingWallpaper.pot @@ -10,11 +10,11 @@ msgstr "" msgid "Indicator icon" msgstr "" -#: ui/Settings4.ui.h:4 extension.js:166 +#: ui/Settings4.ui.h:4 extension.js:156 msgid "Enable desktop notifications" msgstr "" -#: ui/Settings4.ui.h:5 extension.js:148 extension.js:162 +#: ui/Settings4.ui.h:5 extension.js:136 extension.js:152 msgid "Set background image" msgstr "" @@ -31,188 +31,184 @@ msgid "Open folder" msgstr "" #: ui/Settings4.ui.h:9 -msgid "Delete previously downloaded wallpapers" -msgstr "" - -#: ui/Settings4.ui.h:10 msgid "Selected image" msgstr "" -#: ui/Settings4.ui.h:11 +#: ui/Settings4.ui.h:10 msgid "Shuffle enabled" msgstr "" -#: ui/Settings4.ui.h:12 +#: ui/Settings4.ui.h:11 msgid "Shuffle mode" msgstr "" -#: ui/Settings4.ui.h:13 +#: ui/Settings4.ui.h:12 msgid "Bing locale" msgstr "" -#: ui/Settings4.ui.h:14 extension.js:151 +#: ui/Settings4.ui.h:13 extension.js:139 msgid "Settings" msgstr "" -#: ui/Settings4.ui.h:15 +#: ui/Settings4.ui.h:14 msgid "Dynamically switches blur on GDM3 lock screen" msgstr "" -#: ui/Settings4.ui.h:16 +#: ui/Settings4.ui.h:15 msgid "Enable dynamic lockscreen blur" msgstr "" -#: ui/Settings4.ui.h:17 +#: ui/Settings4.ui.h:16 msgid "Blur can improve readability" msgstr "" -#: ui/Settings4.ui.h:18 +#: ui/Settings4.ui.h:17 msgid "Background blur intensity" msgstr "" -#: ui/Settings4.ui.h:19 +#: ui/Settings4.ui.h:18 msgid "Can improve contrast of login prompt" msgstr "" -#: ui/Settings4.ui.h:20 +#: ui/Settings4.ui.h:19 msgid "Background brightness" msgstr "" -#: ui/Settings4.ui.h:21 +#: ui/Settings4.ui.h:20 msgid "Presets" msgstr "" -#: ui/Settings4.ui.h:22 +#: ui/Settings4.ui.h:21 msgid "No blur, slight dim" msgstr "" -#: ui/Settings4.ui.h:23 +#: ui/Settings4.ui.h:22 msgid "GNOME default" msgstr "" -#: ui/Settings4.ui.h:24 +#: ui/Settings4.ui.h:23 msgid "Slight blur, slight dim" msgstr "" -#: ui/Settings4.ui.h:25 +#: ui/Settings4.ui.h:24 msgid "Lock Screen" msgstr "" -#: ui/Settings4.ui.h:26 +#: ui/Settings4.ui.h:25 msgid "Enable logging to system journal" msgstr "" -#: ui/Settings4.ui.h:27 +#: ui/Settings4.ui.h:26 msgid "Debug logging" msgstr "" -#: ui/Settings4.ui.h:28 +#: ui/Settings4.ui.h:27 msgid "Switch to new images when available (unless on random mode)" msgstr "" -#: ui/Settings4.ui.h:29 extension.js:163 +#: ui/Settings4.ui.h:28 extension.js:153 msgid "Always show new images" msgstr "" -#: ui/Settings4.ui.h:30 +#: ui/Settings4.ui.h:29 msgid "Some newer features may be unstable on Wayland" msgstr "" -#: ui/Settings4.ui.h:31 +#: ui/Settings4.ui.h:30 msgid "Enable all features on Wayland" msgstr "" -#: ui/Settings4.ui.h:32 +#: ui/Settings4.ui.h:31 msgid "Screen resolution" msgstr "" -#: ui/Settings4.ui.h:33 +#: ui/Settings4.ui.h:32 msgid "Override automatic resolution selection" msgstr "" -#: ui/Settings4.ui.h:34 +#: ui/Settings4.ui.h:33 msgid "Manually adjust random interval (seconds)" msgstr "" -#: ui/Settings4.ui.h:35 +#: ui/Settings4.ui.h:34 msgid "Random interval" msgstr "" -#: ui/Settings4.ui.h:36 +#: ui/Settings4.ui.h:35 msgid "Import Bing Wallpaper data" msgstr "" -#: ui/Settings4.ui.h:37 +#: ui/Settings4.ui.h:36 msgid "Import previously exported JSON data from wallpaper directory" msgstr "" -#: ui/Settings4.ui.h:38 +#: ui/Settings4.ui.h:37 msgid "Import" msgstr "" -#: ui/Settings4.ui.h:39 +#: ui/Settings4.ui.h:38 msgid "Export Bing Wallpaper data" msgstr "" -#: ui/Settings4.ui.h:40 +#: ui/Settings4.ui.h:39 msgid "Export JSON data to wallpaper dir for backup or data migration" msgstr "" -#: ui/Settings4.ui.h:41 +#: ui/Settings4.ui.h:40 msgid "Export" msgstr "" -#: ui/Settings4.ui.h:42 +#: ui/Settings4.ui.h:41 msgid "Always export Bing data" msgstr "" -#: ui/Settings4.ui.h:43 +#: ui/Settings4.ui.h:42 msgid "Export Bing JSON whenever data changes" msgstr "" -#: ui/Settings4.ui.h:44 +#: ui/Settings4.ui.h:43 msgid "Debug options" msgstr "" -#: ui/Settings4.ui.h:45 +#: ui/Settings4.ui.h:44 msgid "Gallery" msgstr "" -#: ui/Settings4.ui.h:46 +#: ui/Settings4.ui.h:45 msgid "New wallpaper images everyday from Bing" msgstr "" -#: ui/Settings4.ui.h:47 +#: ui/Settings4.ui.h:46 msgid "GNOME shell extension version " msgstr "" -#: ui/Settings4.ui.h:48 +#: ui/Settings4.ui.h:47 msgid "Maintained by Michael Carroll" msgstr "" -#: ui/Settings4.ui.h:49 +#: ui/Settings4.ui.h:48 msgid "" "Show your support to the author on Flattr or Github " "Sponsors." msgstr "" -#: ui/Settings4.ui.h:50 +#: ui/Settings4.ui.h:49 msgid "Changes since last version" msgstr "" -#: ui/Settings4.ui.h:51 +#: ui/Settings4.ui.h:50 msgid "Based on NASA APOD GNOME shell extension by Elia Argentieri" msgstr "" -#: ui/Settings4.ui.h:52 +#: ui/Settings4.ui.h:51 msgid "" "This program comes with ABSOLUTELY NO WARRANTY.\n" "See the GNU General " "Public License, version 3 or later for details." msgstr "" -#: ui/Settings4.ui.h:54 +#: ui/Settings4.ui.h:53 msgid "About" msgstr "" @@ -260,94 +256,102 @@ msgstr "" msgid "every Sunday at midnight" msgstr "" -#: extension.js:141 +#: extension.js:130 msgid "" msgstr "" -#: extension.js:142 extension.js:143 extension.js:144 +#: extension.js:131 extension.js:132 extension.js:142 extension.js:144 msgid "Awaiting refresh..." msgstr "" -#: extension.js:145 +#: extension.js:133 msgid "Copy image to clipboard" msgstr "" -#: extension.js:146 +#: extension.js:134 msgid "Copy image URL to clipboard" msgstr "" -#: extension.js:147 +#: extension.js:135 msgid "Open image folder" msgstr "" -#: extension.js:149 +#: extension.js:137 msgid "Set lock screen image" msgstr "" -#: extension.js:150 +#: extension.js:138 msgid "Refresh Now" msgstr "" -#: extension.js:152 +#: extension.js:140 msgid "Open in image viewer" msgstr "" -#: extension.js:153 +#: extension.js:141 msgid "Open Bing image information page" msgstr "" -#: extension.js:160 +#: extension.js:150 msgid "Quick settings" msgstr "" -#: extension.js:164 +#: extension.js:154 msgid "Image shuffle mode" msgstr "" -#: extension.js:165 +#: extension.js:155 msgid "Image shuffle only favourites" msgstr "" -#: extension.js:167 +#: extension.js:157 msgid "Show image count" msgstr "" -#: extension.js:335 +#: extension.js:158 +msgid "Image shuffle only UHD resolutions" +msgstr "" + +#: extension.js:321 msgid "Next refresh" msgstr "" -#: extension.js:336 +#: extension.js:323 msgid "Last refresh" msgstr "" -#: extension.js:783 extension.js:826 +#: extension.js:326 +msgid "Next shuffle" +msgstr "" + +#: extension.js:801 extension.js:875 msgid "Bing Wallpaper of the Day for" msgstr "" -#: extension.js:857 +#: extension.js:913 msgid "No wallpaper available" msgstr "" -#: extension.js:858 +#: extension.js:914 msgid "No picture for today." msgstr "" -#: prefs.js:160 +#: prefs.js:156 msgid "Select folder" msgstr "" -#: utils.js:130 +#: utils.js:127 msgid "Error fetching change log: " msgstr "" -#: utils.js:413 utils.js:416 +#: utils.js:405 utils.js:408 msgid "minutes" msgstr "" -#: utils.js:419 +#: utils.js:411 msgid "days" msgstr "" -#: utils.js:422 +#: utils.js:414 msgid "hours" msgstr "" diff --git a/locale/cs/LC_MESSAGES/BingWallpaper.mo b/locale/cs/LC_MESSAGES/BingWallpaper.mo index 19eb55fa..7a93e54c 100644 Binary files a/locale/cs/LC_MESSAGES/BingWallpaper.mo and b/locale/cs/LC_MESSAGES/BingWallpaper.mo differ diff --git a/locale/cs/LC_MESSAGES/BingWallpaper.po b/locale/cs/LC_MESSAGES/BingWallpaper.po index 673261c9..788a3710 100644 --- a/locale/cs/LC_MESSAGES/BingWallpaper.po +++ b/locale/cs/LC_MESSAGES/BingWallpaper.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: bing-wallpaper-gnome-extension\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2022-05-26 15:25+0200\n" +"PO-Revision-Date: 2023-11-01 11:48+0100\n" "Last-Translator: Ludek Vydra \n" "Language-Team: \n" "Language: cs_CZ\n" @@ -16,199 +16,203 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 ? 1 : 2);\n" -"X-Generator: Poedit 3.0.1\n" +"X-Generator: Poedit 3.4\n" -#: ui/Settings.ui.h:1 ui/Settings4.ui.h:2 +#: ui/Settings4.ui.h:1 +msgid "Bing Wallpaper pictures folder" +msgstr "Složka tapet z Bing" + +#: ui/Settings4.ui.h:2 msgid "Hide the indicator" msgstr "Skryj ikonu" -#: ui/Settings.ui.h:2 ui/Settings4.ui.h:3 +#: ui/Settings4.ui.h:3 msgid "Indicator icon" msgstr "Ikona indikátoru" -#: ui/Settings.ui.h:3 ui/Settings4.ui.h:4 +#: ui/Settings4.ui.h:4 extension.js:166 msgid "Enable desktop notifications" msgstr "Povolit oznámení na ploše" -#: ui/Settings.ui.h:4 ui/Settings4.ui.h:5 extension.js:131 +#: ui/Settings4.ui.h:5 extension.js:148 extension.js:162 msgid "Set background image" msgstr "Nastav obrázek pozadí" -#: ui/Settings.ui.h:5 ui/Settings4.ui.h:6 +#: ui/Settings4.ui.h:6 msgid "Background style option" msgstr "Možnost stylu pozadí" -#: ui/Settings.ui.h:6 ui/Settings4.ui.h:7 +#: ui/Settings4.ui.h:7 msgid "Download folder" msgstr "Složka pro stažení souborů" -#: ui/Settings.ui.h:7 ui/Settings4.ui.h:1 -msgid "Bing Wallpaper pictures folder" -msgstr "Složka tapet z Bing" - -#: ui/Settings.ui.h:8 ui/Settings4.ui.h:8 +#: ui/Settings4.ui.h:8 msgid "Open folder" msgstr "Otevři složku" -#: ui/Settings.ui.h:9 ui/Settings4.ui.h:9 +#: ui/Settings4.ui.h:9 msgid "Delete previously downloaded wallpapers" msgstr "Smaž tapety, které jste dříve stáhli" -#: ui/Settings.ui.h:10 ui/Settings4.ui.h:10 +#: ui/Settings4.ui.h:10 msgid "Selected image" msgstr "Vybraný obrázek" -#: ui/Settings.ui.h:11 -msgid "Select from image gallery" -msgstr "Vyber z galerie obrázků" +#: ui/Settings4.ui.h:11 +msgid "Shuffle enabled" +msgstr "Náhodně povoleno" + +#: ui/Settings4.ui.h:12 +msgid "Shuffle mode" +msgstr "Náhodný mód" -#: ui/Settings.ui.h:12 ui/Settings4.ui.h:11 +#: ui/Settings4.ui.h:13 msgid "Bing locale" msgstr "Národní nastavení Bing" -#: ui/Settings.ui.h:13 ui/Settings4.ui.h:12 extension.js:134 +#: ui/Settings4.ui.h:14 extension.js:151 msgid "Settings" msgstr "Nastavení" -#: ui/Settings.ui.h:14 ui/Settings4.ui.h:13 -msgid "Use custom blur and brightness" -msgstr "Použij vlastního rozostření a jas" +#: ui/Settings4.ui.h:15 +msgid "Dynamically switches blur on GDM3 lock screen" +msgstr "Dynamicky přepíná rozostření na zamykací obrazovce GDM3" -#: ui/Settings.ui.h:15 ui/Settings4.ui.h:14 -msgid "Override GDM3 lockscreen effects" -msgstr "Zruš GDM3 efekty zamykací obrazovky" +#: ui/Settings4.ui.h:16 +msgid "Enable dynamic lockscreen blur" +msgstr "Povolit dynamické rozostření na zamykací obrazovce" -#: ui/Settings.ui.h:16 ui/Settings4.ui.h:15 -msgid "Blur can improve readability of login prompt" +#: ui/Settings4.ui.h:17 +msgid "Blur can improve readability" msgstr "Rozostření může zlepšit čitelnost výzvy k přihlášení" -#: ui/Settings.ui.h:17 ui/Settings4.ui.h:16 +#: ui/Settings4.ui.h:18 msgid "Background blur intensity" msgstr "Intenzita rozostření pozadí" -#: ui/Settings.ui.h:18 ui/Settings4.ui.h:17 +#: ui/Settings4.ui.h:19 msgid "Can improve contrast of login prompt" msgstr "Může zlepšit kontrast výzvy k přihlášení" -#: ui/Settings.ui.h:19 ui/Settings4.ui.h:18 +#: ui/Settings4.ui.h:20 msgid "Background brightness" msgstr "Jas pozadí" -#: ui/Settings.ui.h:20 ui/Settings4.ui.h:19 +#: ui/Settings4.ui.h:21 msgid "Presets" msgstr "Předvolby" -#: ui/Settings.ui.h:21 -msgid "Commonly used presets" -msgstr "Obvykle používané předvolby" - -#: ui/Settings.ui.h:22 ui/Settings4.ui.h:20 +#: ui/Settings4.ui.h:22 msgid "No blur, slight dim" msgstr "Žádné rozostření, mírné ztmavení" -#: ui/Settings.ui.h:23 ui/Settings4.ui.h:21 +#: ui/Settings4.ui.h:23 msgid "GNOME default" msgstr "Výchozí GNOME" -#: ui/Settings.ui.h:24 ui/Settings4.ui.h:22 +#: ui/Settings4.ui.h:24 msgid "Slight blur, slight dim" msgstr "Mírné rozostření, mírné ztmavení" -#: ui/Settings.ui.h:25 ui/Settings4.ui.h:23 +#: ui/Settings4.ui.h:25 msgid "Lock Screen" msgstr "Uzamčení obrazovky" -#: ui/Settings.ui.h:26 ui/Settings4.ui.h:25 -msgid "Debug logging" -msgstr "Debug logging" - -#: ui/Settings.ui.h:27 ui/Settings4.ui.h:24 +#: ui/Settings4.ui.h:26 msgid "Enable logging to system journal" msgstr "Povolit logování do systémového žurnálu" -#: ui/Settings.ui.h:28 ui/Settings4.ui.h:27 -msgid "Always show new images" -msgstr "Vždy zobrazit nové obrázky" +#: ui/Settings4.ui.h:27 +msgid "Debug logging" +msgstr "Debug logging" -#: ui/Settings.ui.h:29 ui/Settings4.ui.h:26 +#: ui/Settings4.ui.h:28 msgid "Switch to new images when available (unless on random mode)" msgstr "" "Přepínání na nové obrázky, jakmile jsou k dispozici (pokud není zapnutý " "náhodný režim)." -#: ui/Settings.ui.h:30 ui/Settings4.ui.h:29 -msgid "Enable all features on Wayland" -msgstr "Povolení všech funkcí v systému Wayland" +#: ui/Settings4.ui.h:29 extension.js:163 +msgid "Always show new images" +msgstr "Vždy zobrazit nové obrázky" -#: ui/Settings.ui.h:31 ui/Settings4.ui.h:28 +#: ui/Settings4.ui.h:30 msgid "Some newer features may be unstable on Wayland" msgstr "Některé novější funkce mohou být na systému Wayland nestabilní" -#: ui/Settings.ui.h:32 ui/Settings4.ui.h:30 +#: ui/Settings4.ui.h:31 +msgid "Enable all features on Wayland" +msgstr "Povolení všech funkcí v systému Wayland" + +#: ui/Settings4.ui.h:32 msgid "Screen resolution" msgstr "Rozlišení obrazovky" -#: ui/Settings.ui.h:33 ui/Settings4.ui.h:31 +#: ui/Settings4.ui.h:33 msgid "Override automatic resolution selection" msgstr "Přebít automatický výběr rozlišení obrazovky" -#: ui/Settings.ui.h:34 ui/Settings4.ui.h:32 +#: ui/Settings4.ui.h:34 msgid "Manually adjust random interval (seconds)" msgstr "Nastav ručně náhodný interval (sekundy)" -#: ui/Settings.ui.h:35 ui/Settings4.ui.h:33 +#: ui/Settings4.ui.h:35 msgid "Random interval" msgstr "Náhodný interval" -#: ui/Settings.ui.h:36 ui/Settings4.ui.h:34 +#: ui/Settings4.ui.h:36 msgid "Import Bing Wallpaper data" msgstr "Importuj data Bing Wallpaper" -#: ui/Settings.ui.h:37 ui/Settings4.ui.h:35 +#: ui/Settings4.ui.h:37 msgid "Import previously exported JSON data from wallpaper directory" msgstr "Importuj předtím exportovaná data JSON z adresáře tapet" -#: ui/Settings.ui.h:38 ui/Settings4.ui.h:36 +#: ui/Settings4.ui.h:38 msgid "Import" msgstr "Import" -#: ui/Settings.ui.h:39 ui/Settings4.ui.h:37 +#: ui/Settings4.ui.h:39 msgid "Export Bing Wallpaper data" msgstr "Exmportuj data Bing Wallpaper" -#: ui/Settings.ui.h:40 ui/Settings4.ui.h:38 +#: ui/Settings4.ui.h:40 msgid "Export JSON data to wallpaper dir for backup or data migration" msgstr "Exportuj JSON data do adresáře tapet pro zálohování nebo migraci" -#: ui/Settings.ui.h:41 ui/Settings4.ui.h:39 +#: ui/Settings4.ui.h:41 msgid "Export" msgstr "Export" -#: ui/Settings.ui.h:42 ui/Settings4.ui.h:40 +#: ui/Settings4.ui.h:42 msgid "Always export Bing data" msgstr "Vždy exportuj Bing data" -#: ui/Settings.ui.h:43 ui/Settings4.ui.h:41 +#: ui/Settings4.ui.h:43 msgid "Export Bing JSON whenever data changes" msgstr "Exportuj Bing JSON kdykoli se data změní" -#: ui/Settings.ui.h:44 ui/Settings4.ui.h:42 +#: ui/Settings4.ui.h:44 msgid "Debug options" msgstr "Ladicí možnosti" -#: ui/Settings.ui.h:45 ui/Settings4.ui.h:44 +#: ui/Settings4.ui.h:45 +msgid "Gallery" +msgstr "Galerie" + +#: ui/Settings4.ui.h:46 msgid "New wallpaper images everyday from Bing" msgstr "Nové Bing obrázky tapet každý den" -#: ui/Settings.ui.h:46 -msgid "Gnome shell extension version " +#: ui/Settings4.ui.h:47 +msgid "GNOME shell extension version " msgstr "Verze rozšíření Gnome Shell " -#: ui/Settings.ui.h:47 ui/Settings4.ui.h:46 +#: ui/Settings4.ui.h:48 msgid "Maintained by Michael Carroll" msgstr "Správcem je Michael Carroll" -#: ui/Settings.ui.h:48 ui/Settings4.ui.h:47 +#: ui/Settings4.ui.h:49 msgid "" "Show your support to the author on Flattr or Github " @@ -217,15 +221,15 @@ msgstr "" "Podpořte autora na Flattr nebo Github Sponsors." -#: ui/Settings.ui.h:49 ui/Settings4.ui.h:48 +#: ui/Settings4.ui.h:50 msgid "Changes since last version" msgstr "Změny od poslední verze" -#: ui/Settings.ui.h:50 ui/Settings4.ui.h:49 -msgid "Based on NASA APOD Gnome shell extension by Elia Argentieri" -msgstr "Založeno na Gnome rozšíření NASA APOD od Elia Argentieriho" +#: ui/Settings4.ui.h:51 +msgid "Based on NASA APOD GNOME shell extension by Elia Argentieri" +msgstr "Založeno na rozšíření NASA APOD GNOME od Elia Argentieriho" -#: ui/Settings.ui.h:51 ui/Settings4.ui.h:50 +#: ui/Settings4.ui.h:52 msgid "" "This program comes with ABSOLUTELY NO WARRANTY.\n" "See the GNU General " @@ -236,137 +240,181 @@ msgstr "" "licenses/gpl-2.0.html\">Obecná veřejná licence GNU v.3 nebo pozdější." -#: ui/Settings.ui.h:53 ui/Settings4.ui.h:52 +#: ui/Settings4.ui.h:54 msgid "About" msgstr "O rozšíření" -#: ui/Settings4.ui.h:43 -msgid "Gallery" -msgstr "Galerie" - -#: ui/Settings4.ui.h:45 -msgid "GNOME shell extension version " -msgstr "Verze rozšíření Gnome Shell " +#: ui/carousel4.ui.h:1 +msgid "Favorite" +msgstr "Oblíbené" -#: ui/carousel.ui.h:1 ui/carousel4.ui.h:1 +#: ui/carousel4.ui.h:2 msgid "Apply" msgstr "Použij" -#: ui/carousel.ui.h:2 ui/carousel4.ui.h:2 +#: ui/carousel4.ui.h:3 msgid "View" msgstr "Zobrazit" -#: ui/carousel.ui.h:3 ui/carousel4.ui.h:3 +#: ui/carousel4.ui.h:4 msgid "Info" msgstr "Info" -#: ui/carousel.ui.h:4 ui/carousel4.ui.h:4 +#: ui/carousel4.ui.h:5 msgid "Delete" msgstr "Vymaž" -#: ui/carousel.ui.h:5 ui/carousel4.ui.h:6 -msgid "Set random mode" -msgstr "Nastav náhodný mód" - -#: ui/carousel4.ui.h:5 +#: ui/carousel4.ui.h:6 msgid "" msgstr "" #: ui/carousel4.ui.h:7 +msgid "Set random mode" +msgstr "Nastav náhodný mód" + +#: ui/carousel4.ui.h:8 msgid "Load image gallery" msgstr "Nahrej galerii obrázků" -#: extension.js:119 +#: ui/intervals.utils.js.h:2 +msgid "on the hour" +msgstr "v hodině" + +#: ui/intervals.utils.js.h:5 +msgid "every day at midnight" +msgstr "každý den o půlnoci" + +#: ui/intervals.utils.js.h:8 +msgid "every Sunday at midnight" +msgstr "každou neděli o půlnoci" + +#: extension.js:141 msgid "" msgstr "" -#: extension.js:121 extension.js:123 extension.js:126 +#: extension.js:142 extension.js:143 extension.js:144 msgid "Awaiting refresh..." msgstr "Čekám na obnovu..." -#: extension.js:128 +#: extension.js:145 msgid "Copy image to clipboard" msgstr "Kopíruj obrázek do schránky" -#: extension.js:129 +#: extension.js:146 msgid "Copy image URL to clipboard" msgstr "Kopíruj URL obrázku do schránky" -#: extension.js:130 +#: extension.js:147 msgid "Open image folder" msgstr "Otevři adresář s obrázky" -#: extension.js:132 +#: extension.js:149 msgid "Set lock screen image" msgstr "Nastav obrázek při uzamčení obrazovky" -#: extension.js:133 +#: extension.js:150 msgid "Refresh Now" msgstr "Obnov teď" -#: extension.js:246 +#: extension.js:152 +msgid "Open in image viewer" +msgstr "Otevři v prohlížeči" + +#: extension.js:153 +msgid "Open Bing image information page" +msgstr "Otevři Bing image informační stránku" + +#: extension.js:160 +msgid "Quick settings" +msgstr "Rychlé nastavení" + +#: extension.js:164 +msgid "Image shuffle mode" +msgstr "Mód náhodného přehrávání obrázků" + +#: extension.js:165 +msgid "Image shuffle only favourites" +msgstr "Mód náhodného přehrávání jen favoritů" + +#: extension.js:167 +msgid "Show image count" +msgstr "Zobrazit počet obrázků" + +#: extension.js:335 msgid "Next refresh" msgstr "Příští obnova" -#: extension.js:569 extension.js:599 +#: extension.js:336 +msgid "Last refresh" +msgstr "Poslední obnova" + +#: extension.js:783 extension.js:826 msgid "Bing Wallpaper of the Day for" msgstr "Tapeta z Bing pro den" -#: extension.js:626 +#: extension.js:857 msgid "No wallpaper available" msgstr "Žádná tapeta není dostupná" -#: extension.js:627 +#: extension.js:858 msgid "No picture for today." -msgstr "Dnes není žádný obrázek k dispozici." +msgstr "Dnes není dostupný žádný obrázek." -#: prefs.js:168 +#: prefs.js:160 msgid "Select folder" msgstr "Vyber adresář" -#: prefs.js:233 -msgid "Most recent image" -msgstr "Dnešní obrázek" +#: utils.js:130 +msgid "Error fetching change log: " +msgstr "Chyba stahování protokolu změn: " -#: prefs.js:234 -msgid "Random image" -msgstr "Náhodný obrázek" +#: utils.js:413 utils.js:416 +msgid "minutes" +msgstr "minut" -#: utils.js:116 -msgid "Fetching data..." -msgstr "Stahuji data..." +#: utils.js:419 +msgid "days" +msgstr "dnů" -#: utils.js:127 -msgid "Market not available in your region" -msgstr "Nabídka není k dispozici na vašem území" +#: utils.js:422 +msgid "hours" +msgstr "hodin" -#: utils.js:131 -msgid "A network error occured" -msgstr "Nastala síťová chyba" +#~ msgid "Select from image gallery" +#~ msgstr "Vyber z galerie obrázků" -#: utils.js:136 -msgid "Too many requests in 5 seconds" -msgstr "Příliš mnoho požadavků během posledních 5 sekund" +#~ msgid "Use custom blur and brightness" +#~ msgstr "Použij vlastního rozostření a jas" -#: utils.js:162 -msgid "No change log found for this release" -msgstr "V tomto vydání nebyl nalezen protokol změn" +#~ msgid "Override GDM3 lockscreen effects" +#~ msgstr "Zruš GDM3 efekty zamykací obrazovky" -#: utils.js:168 -msgid "Error fetching change log" -msgstr "Chyba stahování protokolu změn" +#~ msgid "Commonly used presets" +#~ msgstr "Obvykle používané předvolby" -#: utils.js:383 utils.js:386 -msgid "minutes" -msgstr "minut" +#~ msgid "Gnome shell extension version " +#~ msgstr "Verze rozšíření Gnome Shell " -#: utils.js:389 -msgid "days" -msgstr "dnů" +#~ msgid "Most recent image" +#~ msgstr "Dnešní obrázek" -#: utils.js:392 -msgid "hours" -msgstr "hodin" +#~ msgid "Random image" +#~ msgstr "Náhodný obrázek" + +#~ msgid "Fetching data..." +#~ msgstr "Stahuji data..." + +#~ msgid "Market not available in your region" +#~ msgstr "Nabídka není k dispozici na vašem území" + +#~ msgid "A network error occured" +#~ msgstr "Nastala síťová chyba" + +#~ msgid "Too many requests in 5 seconds" +#~ msgstr "Příliš mnoho požadavků během posledních 5 sekund" + +#~ msgid "No change log found for this release" +#~ msgstr "V tomto vydání nebyl nalezen protokol změn" #~ msgid "Days to store wallpapers before deleting" #~ msgstr "Počet dní před tím, nežli jsou tapety smazány" diff --git a/metadata.json b/metadata.json index cf2d7374..e35c0675 100644 --- a/metadata.json +++ b/metadata.json @@ -4,7 +4,7 @@ "name": "Bing Wallpaper", "settings-schema": "org.gnome.shell.extensions.bingwallpaper", "description": "Sync 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\nFeatures:\n* UHD resolution wallpapers\n* Automatically fetches current Bing wallpaper of the day and sets as both lock screen and desktop wallpaper (user selectable on GNOME versions that support it)\n* Doesn't poll continuously - only once per day and on startup (schedules a refresh when Bing is due to update)\n * random mode (from previously downloaded wallpapers)\n *NEW: select/cycle wallpaper through previously downloaded images\n* Language support: English (en), German (de), Dutch (nl), Italian (it), Polish (pl), Chinese (zh_CN, zh_TW), French (fr), Portuguese (pt), Ukrainian (uk), Russian (ru_RU), Spanish (es), Korean (ko), Indonesian (id), Catalan (ca), Norwegian Bokmål (nb) & Nynorsk (ni), Swedish (sv), Arabic (ar), Hungarian (hu) and Japanese (ja) - a HUGE thanks to the translators\n\nThis extension was forked from 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\nAlways restart GNOME after manually updating extensions. Please report bugs to the GitHub page below:", - "version": "47", + "version": "48", "url": "https://github.com/neffo/bing-wallpaper-gnome-extension", "gettext-domain": "BingWallpaper" } diff --git a/prefs.js b/prefs.js index a23424b1..4986c7aa 100644 --- a/prefs.js +++ b/prefs.js @@ -72,7 +72,6 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen let marketEntry = buildable.get_object('market'); let resolutionEntry = buildable.get_object('resolution'); let historyEntry = buildable.get_object('history'); - let deleteSwitch = buildable.get_object('delete_previous'); icon_image = buildable.get_object('icon_image'); let overrideSwitch = buildable.get_object('lockscreen_override'); let strengthEntry = buildable.get_object('entry_strength'); @@ -216,8 +215,6 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen styleEntry.append(style, style); }); desktop_settings.bind('picture-options', styleEntry, 'active_id', Gio.SettingsBindFlags.DEFAULT); - - settings.bind('delete-previous', deleteSwitch, 'active', Gio.SettingsBindFlags.DEFAULT); // GDM3 lockscreen blur override settings.bind('override-lockscreen-blur', overrideSwitch, 'active', Gio.SettingsBindFlags.DEFAULT); diff --git a/ui/Settings4.ui b/ui/Settings4.ui index de169816..073a3bff 100644 --- a/ui/Settings4.ui +++ b/ui/Settings4.ui @@ -336,41 +336,6 @@ Bing Wallpaper GNOME extension by: Michael Carroll - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - Delete previously downloaded wallpapers - - 0 - 0 - - - - - - end - 1 - - 1 - 0 - - - - - - - diff --git a/utils.js b/utils.js index b2c8d91e..6f2ff22c 100644 --- a/utils.js +++ b/utils.js @@ -18,7 +18,6 @@ export var PRESET_SLIGHT_BLUR = { blur: 2, dim: 60 }; export var BING_SCHEMA = 'org.gnome.shell.extensions.bingwallpaper'; export var DESKTOP_SCHEMA = 'org.gnome.desktop.background'; -export var LOCKSCREEN_SCHEMA = 'org.gnome.desktop.screensaver'; var vertical_blur = null; var horizontal_blur = null; @@ -49,7 +48,7 @@ export var marketName = [ 'українська (Україна)', '中文(中国)', '中文(中國香港特別行政區)', '中文(台灣)' ]; -export var backgroundStyle = ['none', 'wallpaper', 'centered', 'scaled', 'stretched', 'zoom', 'spanned']; +export var backgroundStyle = ['none', 'wallpaper', 'centered', 'scaled', 'stretched', 'zoom', 'spanned']; // this may change in the future export var randomIntervals = [ {value: 'hourly', title: ('on the hour')}, {value: 'daily', title: ('every day at midnight')}, @@ -312,7 +311,7 @@ export function cleanupImageList(settings) { setImageList(settings, newList); } -function populateImageListResolutions(settings) { +export function populateImageListResolutions(settings) { let curList = imageListSortByDate(getImageList(settings)); let newList = []; curList.forEach( function (x, i) { @@ -328,6 +327,21 @@ function populateImageListResolutions(settings) { setImageList(settings, newList); } +export function getFetchableImageList(settings) { + let imageList = getImageList(settings); + let cutOff = GLib.DateTime.new_now_utc().add_days(-8); // 8 days ago + let dlList = []; + imageList.forEach( function (x, i) { + let diff = dateFromLongDate(x.fullstartdate, 0).difference(cutOff); + let filename = imageToFilename(settings, x); + // image is still downloadable (< 8 days old) but not on disk + if (diff > 0 && !Gio.file_new_for_path(filename).query_exists(null)) { + dlList.push(x); + } + }); + return dlList; +} + export function getWallpaperDir(settings) { let homeDir = GLib.get_home_dir(); let BingWallpaperDir = settings.get_string('download-folder').replace('~', homeDir);