diff --git a/.gitignore b/.gitignore index 2030b189..e14429bf 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ Settings.ui.h Settings4.ui.h carousel.ui.h carousel4.ui.h +prefsadw.ui.h test.js diff --git a/blur.js b/blur.js index e063be6e..95c7b774 100644 --- a/blur.js +++ b/blur.js @@ -37,7 +37,7 @@ function log(msg) { } // we patch UnlockDialog._updateBackgroundEffects() -function _updateBackgroundEffects_BWP(monitorIndex) { +export function _updateBackgroundEffects_BWP(monitorIndex) { // GNOME shell 3.36.4 and above log("_updateBackgroundEffects_BWP() called for shell >= 3.36.4"); const themeContext = St.ThemeContext.get_for_stage(global.stage); @@ -68,18 +68,26 @@ function _updateBackgroundEffects_BWP(monitorIndex) { // we patch both UnlockDialog._showClock() and UnlockDialog._showPrompt() to let us // adjustable blur in a Windows-like way (this ensures login prompt is readable) -function _showClock_BWP() { +export function _showClock_BWP() { promptActive = false; this._showClock_GNOME(); // pass to default GNOME function this._updateBackgroundEffects(); } -function _showPrompt_BWP() { +export function _showPrompt_BWP() { promptActive = true; this._showPrompt_GNOME(); // pass to default GNOME function this._updateBackgroundEffects(); } +export function _clampValue(value) { + // valid values are 0 to 100 + if (value > 100) + value = 100; + if (value < 0 ) + value = 0; + return value; +} export default class Blur { constructor() { this.enabled = false; @@ -87,24 +95,15 @@ export default class Blur { } set_blur_strength(value) { - BWP_BLUR_SIGMA = this._clampValue(value); + BWP_BLUR_SIGMA = _clampValue(value); log("lockscreen blur strength set to "+BWP_BLUR_SIGMA); } set_blur_brightness(value) { - BWP_BLUR_BRIGHTNESS = this._clampValue(value); + BWP_BLUR_BRIGHTNESS = _clampValue(value); log("lockscreen brightness set to " + BWP_BLUR_BRIGHTNESS); } - // valid values are 0 to 100 - _clampValue(value) { - if (value > 100) - value = 100; - if (value < 0 ) - value = 0; - return value; - } - _switch(enabled) { if (enabled && !this.enabled) { this._enable(); diff --git a/buildzip.sh b/buildzip.sh index f5e88b60..a3903fca 100755 --- a/buildzip.sh +++ b/buildzip.sh @@ -5,9 +5,9 @@ # the tools, but test builds in VMs it (generally) should be ok glib-compile-schemas schemas/ -intltool-extract --type=gettext/glade ui/Settings4.ui +intltool-extract --type=gettext/glade ui/prefsadw.ui intltool-extract --type=gettext/glade ui/carousel4.ui -xgettext -k -k_ -kN_ --omit-header -o locale/BingWallpaper.pot ui/Settings4.ui.h ui/carousel4.ui.h ui/intervals.utils.js.h extension.js prefs.js blur.js utils.js --from-code=UTF-8 +xgettext -k -k_ -kN_ --omit-header -o locale/BingWallpaper.pot ui/prefsadw.ui.h ui/carousel4.ui.h ui/intervals.utils.js.h extension.js prefs.js blur.js utils.js --from-code=UTF-8 DATE=`date +"%F"` echo "# Translation status of statements as at $DATE:" > translations.txt diff --git a/carousel.js b/carousel.js index c673b142..f522ee78 100644 --- a/carousel.js +++ b/carousel.js @@ -107,8 +107,8 @@ export default class Carousel { deleteButton.connect('clicked', (widget) => { this.log('Delete requested for '+filename); Utils.deleteImage(filename); - //Utils.cleanupImageList(this.settings); // hide image instead - Utils.hideImage(this.settings, [image]); + Utils.setImageHiddenStatus(this.settings, image.urlbase, true); + Utils.cleanupImageList(this.settings); // hide image instead widget.get_parent().get_parent().set_visible(false); // bit of a hack if (this.callbackfunc) this.callbackfunc(); @@ -169,6 +169,7 @@ export default class Carousel { this.flowBox.remove(widget.get_parent()); this.flowBox.set_max_children_per_line(2); this._create_gallery(); + }); let item = buildable.get_object('flowBoxPlaceholder'); diff --git a/extension.js b/extension.js index e286d0f9..493e2c84 100644 --- a/extension.js +++ b/extension.js @@ -561,6 +561,7 @@ class BingWallpaperIndicator extends Button { _randomModeChanged() { let randomEnabled = this._settings.get_boolean('random-mode-enabled'); + Utils.validate_interval(this._settings); [this.toggleShuffleOnlyFaves, this.toggleShuffleOnlyUHD /*, this.toggleShuffleOnlyUnhidden*/] .forEach( x => { x.setSensitive(randomEnabled); @@ -588,8 +589,14 @@ class BingWallpaperIndicator extends 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); + Utils.setImageHiddenStatus(this._settings, this.imageURL, this.hidden_status); + this._setTrashIcon(this.hidden_status?this.ICON_UNTRASH_BUTTON:this.ICON_TRASH_BUTTON); + if (this._settings.get_boolean('trash-deletes-images')) { + log('image to be deleted: '+this.filename); + Utils.deleteImage(this.filename); + Utils.validate_imagename(this._settings); + } + } _setFavouriteIcon(icon_name) { @@ -715,7 +722,7 @@ class BingWallpaperIndicator extends Button { 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) { + if (diff > 30) { // on occasions the above will be 1 second 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') { @@ -842,6 +849,7 @@ class BingWallpaperIndicator extends Button { // special values, 'current' is most recent (default mode), 'random' picks one at random, anything else should be filename if (force_shuffle) { + log('forcing shuffle of image') image = this._shuffleImage(); if (this._settings.get_boolean('random-mode-enabled')) this._restartShuffleTimeout(); diff --git a/locale/BingWallpaper.pot b/locale/BingWallpaper.pot index f356658d..ab4eb258 100644 --- a/locale/BingWallpaper.pot +++ b/locale/BingWallpaper.pot @@ -1,215 +1,225 @@ -#: ui/Settings4.ui.h:1 -msgid "Bing Wallpaper pictures folder" +#: ui/prefsadw.ui.h:1 extension.js:139 +msgid "Settings" msgstr "" -#: ui/Settings4.ui.h:2 -msgid "Hide the indicator" +#: ui/prefsadw.ui.h:2 +msgid "Indicator" msgstr "" -#: ui/Settings4.ui.h:3 -msgid "Indicator icon" +#: ui/prefsadw.ui.h:3 +msgid "Hide Indicator" msgstr "" -#: ui/Settings4.ui.h:4 extension.js:156 -msgid "Enable desktop notifications" +#: ui/prefsadw.ui.h:4 +msgid "Whether to hide the panel indicator" msgstr "" -#: ui/Settings4.ui.h:5 extension.js:136 extension.js:152 -msgid "Set background image" +#: ui/prefsadw.ui.h:5 +msgid "Desktop notifications" msgstr "" -#: ui/Settings4.ui.h:6 -msgid "Background style option" +#: ui/prefsadw.ui.h:6 +msgid "Enable notifications on new images" msgstr "" -#: ui/Settings4.ui.h:7 -msgid "Download folder" +#: ui/prefsadw.ui.h:7 +msgid "Indicator icon" msgstr "" -#: ui/Settings4.ui.h:8 -msgid "Open folder" +#: ui/prefsadw.ui.h:8 +msgid "Select from alternate tray icons" msgstr "" -#: ui/Settings4.ui.h:9 -msgid "Selected image" +#: ui/prefsadw.ui.h:9 +msgid "Download folder" msgstr "" -#: ui/Settings4.ui.h:10 -msgid "Shuffle enabled" +#: ui/prefsadw.ui.h:10 +msgid "Open or change wallpaper downloads folder" msgstr "" -#: ui/Settings4.ui.h:11 -msgid "Shuffle mode" +#: ui/prefsadw.ui.h:11 +msgid "Wallpaper" msgstr "" -#: ui/Settings4.ui.h:12 -msgid "Bing locale" +#: ui/prefsadw.ui.h:12 +msgid "Set wallpaper" msgstr "" -#: ui/Settings4.ui.h:13 extension.js:139 -msgid "Settings" +#: ui/prefsadw.ui.h:13 +msgid "Whether to set wallpaper automatically" msgstr "" -#: ui/Settings4.ui.h:14 -msgid "Dynamically switches blur on GDM3 lock screen" +#: ui/prefsadw.ui.h:14 +msgid "Shuffle wallpaper" msgstr "" -#: ui/Settings4.ui.h:15 -msgid "Enable dynamic lockscreen blur" +#: ui/prefsadw.ui.h:15 +msgid "Randomly select wallpaper from collection" msgstr "" -#: ui/Settings4.ui.h:16 -msgid "Blur can improve readability" +#: ui/prefsadw.ui.h:16 +msgid "Shuffle interval" msgstr "" -#: ui/Settings4.ui.h:17 -msgid "Background blur intensity" +#: ui/prefsadw.ui.h:17 +msgid "How frequently to shuffle wallpapers" msgstr "" -#: ui/Settings4.ui.h:18 -msgid "Can improve contrast of login prompt" +#: ui/prefsadw.ui.h:18 +msgid "Downloads" msgstr "" -#: ui/Settings4.ui.h:19 -msgid "Background brightness" +#: ui/prefsadw.ui.h:19 +msgid "Lock screen" msgstr "" -#: ui/Settings4.ui.h:20 -msgid "Presets" +#: ui/prefsadw.ui.h:20 +msgid "Lockscreen blur" msgstr "" -#: ui/Settings4.ui.h:21 -msgid "No blur, slight dim" +#: ui/prefsadw.ui.h:21 +msgid "Dynamic lockscreen blur" msgstr "" -#: ui/Settings4.ui.h:22 -msgid "GNOME default" +#: ui/prefsadw.ui.h:22 +msgid "Whether to enable dynamic blur mode on lock screen" msgstr "" -#: ui/Settings4.ui.h:23 -msgid "Slight blur, slight dim" +#: ui/prefsadw.ui.h:23 +msgid "Blur strength" msgstr "" -#: ui/Settings4.ui.h:24 -msgid "Lock Screen" +#: ui/prefsadw.ui.h:24 +msgid "Blur strength when login prompt is not visible" msgstr "" -#: ui/Settings4.ui.h:25 -msgid "Enable logging to system journal" +#: ui/prefsadw.ui.h:25 +msgid "Wallpaper brightness" msgstr "" -#: ui/Settings4.ui.h:26 -msgid "Debug logging" +#: ui/prefsadw.ui.h:26 +msgid "Dim wallpaper when login prompt is not visible" msgstr "" -#: ui/Settings4.ui.h:27 -msgid "Switch to new images when available (unless on random mode)" +#: ui/prefsadw.ui.h:27 +msgid "Presets" msgstr "" -#: ui/Settings4.ui.h:28 extension.js:153 -msgid "Always show new images" +#: ui/prefsadw.ui.h:28 +msgid "Gallery" msgstr "" -#: ui/Settings4.ui.h:29 -msgid "Some newer features may be unstable on Wayland" +#: ui/prefsadw.ui.h:29 +msgid "Debug" msgstr "" -#: ui/Settings4.ui.h:30 -msgid "Enable all features on Wayland" +#: ui/prefsadw.ui.h:30 +msgid "Debug options" msgstr "" -#: ui/Settings4.ui.h:31 -msgid "Screen resolution" +#: ui/prefsadw.ui.h:31 +msgid "Debug logging" msgstr "" -#: ui/Settings4.ui.h:32 -msgid "Override automatic resolution selection" +#: ui/prefsadw.ui.h:32 +msgid "Enable logging to system journal" msgstr "" -#: ui/Settings4.ui.h:33 -msgid "Manually adjust random interval (seconds)" +#: ui/prefsadw.ui.h:33 extension.js:153 +msgid "Always show new images" msgstr "" -#: ui/Settings4.ui.h:34 -msgid "Random interval" +#: ui/prefsadw.ui.h:34 +msgid "Switch to new images when available (unless on random mode)" msgstr "" -#: ui/Settings4.ui.h:35 -msgid "Import Bing Wallpaper data" +#: ui/prefsadw.ui.h:35 +msgid "Purge on trash" msgstr "" -#: ui/Settings4.ui.h:36 -msgid "Import previously exported JSON data from wallpaper directory" +#: ui/prefsadw.ui.h:36 +msgid "Trashing an image will remove it from database" msgstr "" -#: ui/Settings4.ui.h:37 -msgid "Import" +#: ui/prefsadw.ui.h:37 +msgid "Screen resolution" msgstr "" -#: ui/Settings4.ui.h:38 -msgid "Export Bing Wallpaper data" +#: ui/prefsadw.ui.h:38 +msgid "Override automatic resolution selection" msgstr "" -#: ui/Settings4.ui.h:39 -msgid "Export JSON data to wallpaper dir for backup or data migration" +#: ui/prefsadw.ui.h:39 +msgid "Random interval" msgstr "" -#: ui/Settings4.ui.h:40 -msgid "Export" +#: ui/prefsadw.ui.h:40 +msgid "Custom shuffle interval when enabled" msgstr "" -#: ui/Settings4.ui.h:41 +#: ui/prefsadw.ui.h:41 msgid "Always export Bing data" msgstr "" -#: ui/Settings4.ui.h:42 -msgid "Export Bing JSON whenever data changes" +#: ui/prefsadw.ui.h:42 +msgid "Export Bing JSON when image data changes" msgstr "" -#: ui/Settings4.ui.h:43 -msgid "Debug options" +#: ui/prefsadw.ui.h:43 +msgid "Bing JSON data" msgstr "" -#: ui/Settings4.ui.h:44 -msgid "Gallery" +#: ui/prefsadw.ui.h:44 +msgid "About" msgstr "" -#: ui/Settings4.ui.h:45 -msgid "New wallpaper images everyday from Bing" +#: ui/prefsadw.ui.h:45 +msgid "Bing Wallpaper" msgstr "" -#: ui/Settings4.ui.h:46 -msgid "GNOME shell extension version " +#: ui/prefsadw.ui.h:46 +msgid "New wallpaper images everyday from Bing" msgstr "" -#: ui/Settings4.ui.h:47 +#: ui/prefsadw.ui.h:47 msgid "Maintained by Michael Carroll" msgstr "" -#: ui/Settings4.ui.h:48 -msgid "" -"Show your support to the author on Flattr or Github " -"Sponsors." +#: ui/prefsadw.ui.h:48 +msgid "Version" msgstr "" -#: ui/Settings4.ui.h:49 -msgid "Changes since last version" +#: ui/prefsadw.ui.h:49 +msgid "Release notes" msgstr "" -#: ui/Settings4.ui.h:50 -msgid "Based on NASA APOD GNOME shell extension by Elia Argentieri" +#: ui/prefsadw.ui.h:50 +msgid "GNOME extensions page" msgstr "" -#: 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." +#: ui/prefsadw.ui.h:51 +msgid "Source code" msgstr "" -#: ui/Settings4.ui.h:53 -msgid "About" +#: ui/prefsadw.ui.h:52 +msgid "Report an issue" +msgstr "" + +#: ui/prefsadw.ui.h:53 +msgid "Contributors" +msgstr "" + +#: ui/prefsadw.ui.h:54 +msgid "License" +msgstr "" + +#: ui/prefsadw.ui.h:55 prefs.js:115 +msgid "Change folder" +msgstr "" + +#: ui/prefsadw.ui.h:56 +msgid "Select new wallpaper download folder" msgstr "" #: ui/carousel4.ui.h:1 @@ -276,6 +286,10 @@ msgstr "" msgid "Open image folder" msgstr "" +#: extension.js:136 extension.js:152 +msgid "Set background image" +msgstr "" + #: extension.js:137 msgid "Set lock screen image" msgstr "" @@ -304,6 +318,10 @@ msgstr "" msgid "Image shuffle only favourites" msgstr "" +#: extension.js:156 +msgid "Enable desktop notifications" +msgstr "" + #: extension.js:157 msgid "Show image count" msgstr "" @@ -324,34 +342,58 @@ msgstr "" msgid "Next shuffle" msgstr "" -#: extension.js:801 extension.js:875 +#: extension.js:808 extension.js:883 msgid "Bing Wallpaper of the Day for" msgstr "" -#: extension.js:913 +#: extension.js:921 msgid "No wallpaper available" msgstr "" -#: extension.js:914 +#: extension.js:922 msgid "No picture for today." msgstr "" -#: prefs.js:156 -msgid "Select folder" +#: prefs.js:107 +msgid "Open folder" +msgstr "" + +#: prefs.js:130 +msgid "Default" +msgstr "" + +#: prefs.js:138 +msgid "No blur, slight dim" +msgstr "" + +#: prefs.js:146 +msgid "Slight blur & dim" +msgstr "" + +#: prefs.js:163 +msgid "Import" +msgstr "" + +#: prefs.js:171 +msgid "Export" +msgstr "" + +#: prefs.js:238 +msgid "Select wallpaper download folder" msgstr "" -#: utils.js:127 +#: utils.js:134 msgid "Error fetching change log: " msgstr "" -#: utils.js:405 utils.js:408 +#: utils.js:413 utils.js:416 msgid "minutes" msgstr "" -#: utils.js:411 +#: utils.js:419 msgid "days" msgstr "" -#: utils.js:414 +#: utils.js:422 msgid "hours" msgstr "" diff --git a/locale/pt_BR/LC_MESSAGES/BingWallpaper.mo b/locale/pt_BR/LC_MESSAGES/BingWallpaper.mo index 23eded60..618d3971 100644 Binary files a/locale/pt_BR/LC_MESSAGES/BingWallpaper.mo and b/locale/pt_BR/LC_MESSAGES/BingWallpaper.mo differ diff --git a/locale/pt_BR/LC_MESSAGES/BingWallpaper.po b/locale/pt_BR/LC_MESSAGES/BingWallpaper.po index 742fe795..d65a3e81 100644 --- a/locale/pt_BR/LC_MESSAGES/BingWallpaper.po +++ b/locale/pt_BR/LC_MESSAGES/BingWallpaper.po @@ -1,166 +1,237 @@ +# +# Juliano de Souza Camargo , 2024. +# msgid "" msgstr "" "Project-Id-Version: bing-wallpaper-gnome-extension\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-05-09 18:12+1000\n" -"PO-Revision-Date: 2021-06-24 17:30-0300\n" -"Last-Translator: \n" -"Language-Team: Portuguese, Brazilian\n" +"PO-Revision-Date: 2024-01-04 12:59-0300\n" +"Last-Translator: Juliano de Souza Camargo \n" +"Language-Team: Brazilian Portuguese \n" "Language: pt_BR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Plural-Forms: nplurals=2; plural=(n > 1)\n" "X-Crowdin-Project: bing-wallpaper-gnome-extension\n" "X-Crowdin-Project-ID: 451876\n" "X-Crowdin-Language: pt-BR\n" "X-Crowdin-File: BingWallpaper.pot\n" "X-Crowdin-File-ID: 2\n" -"X-Generator: Poedit 3.0\n" +"X-Generator: Gtranslator 45.3\n" -#: Settings.ui.h:1 Settings4.ui.h:2 +#: ui/Settings4.ui.h:1 +msgid "Bing Wallpaper pictures folder" +msgstr "Pasta de imagens do Bing Wallpaper" + +#: ui/Settings4.ui.h:2 msgid "Hide the indicator" msgstr "Ocultar o indicador" -#: Settings.ui.h:2 Settings4.ui.h:3 +#: ui/Settings4.ui.h:3 msgid "Indicator icon" msgstr "Ícone do indicador" -#: Settings.ui.h:3 Settings4.ui.h:4 +#: ui/Settings4.ui.h:4 extension.js:156 msgid "Enable desktop notifications" msgstr "Habilitar notificações na Área de Trabalho" -#: Settings.ui.h:4 Settings4.ui.h:5 extension.js:129 +#: ui/Settings4.ui.h:5 extension.js:136 extension.js:152 msgid "Set background image" msgstr "Definir imagem de fundo" -#: Settings.ui.h:5 Settings4.ui.h:6 extension.js:130 -msgid "Set lock screen image" -msgstr "Definir imagem da tela de bloqueio" +#: ui/Settings4.ui.h:6 +msgid "Background style option" +msgstr "Opção de estilo de fundo" -#: Settings.ui.h:6 Settings4.ui.h:7 +#: ui/Settings4.ui.h:7 msgid "Download folder" msgstr "Pasta de download" -#: Settings.ui.h:7 Settings4.ui.h:1 -msgid "Bing Wallpaper pictures folder" -msgstr "Pasta de imagens do Bing Wallpaper" +#: ui/Settings4.ui.h:8 +msgid "Open folder" +msgstr "Abrir pasta" + +#: ui/Settings4.ui.h:9 +msgid "Selected image" +msgstr "Imagem selecionada" -#: Settings.ui.h:8 Settings4.ui.h:9 -msgid "Delete previously downloaded wallpapers" -msgstr "Excluir papéis de parede baixados anteriormente" +#: ui/Settings4.ui.h:10 +msgid "Shuffle enabled" +msgstr "Embaralhar ativado" -#: Settings.ui.h:9 Settings4.ui.h:10 -msgid "Days to store wallpapers before deleting" -msgstr "Dias para armazenar papéis de parede antes de excluir" +#: ui/Settings4.ui.h:11 +msgid "Shuffle mode" +msgstr "Modo embaralhar" -#: Settings.ui.h:10 Settings4.ui.h:11 +#: ui/Settings4.ui.h:12 msgid "Bing locale" msgstr "Idioma do Bing" -#: Settings.ui.h:11 Settings4.ui.h:12 -msgid "Default is English - United States" -msgstr "O padrão é inglês - Estados Unidos" - -#: Settings.ui.h:12 Settings4.ui.h:14 -msgid "Screen resolution" -msgstr "Resolução de tela" - -#: Settings.ui.h:13 Settings4.ui.h:15 -msgid "Override automatic resolution selection" -msgstr "Substituir a seleção de resolução automática" - -#: Settings.ui.h:14 Settings4.ui.h:13 -msgid "Selected image" -msgstr "Imagem selecionada" - -#: Settings.ui.h:15 Settings4.ui.h:16 extension.js:132 +#: ui/Settings4.ui.h:13 extension.js:139 msgid "Settings" msgstr "Configurações" -#: Settings.ui.h:16 Settings4.ui.h:17 -msgid "Use custom blur and brightness" -msgstr "Usar desfoque e brilho personalizados" +#: ui/Settings4.ui.h:14 +msgid "Dynamically switches blur on GDM3 lock screen" +msgstr "Altera dinamicamente o desfoque na tela de bloqueio GDM3" -#: Settings.ui.h:17 Settings4.ui.h:18 -msgid "Override GDM3 lockscreen effects" -msgstr "Sobrescrever efeitos de bloqueio de tela GDM3" +#: ui/Settings4.ui.h:15 +msgid "Enable dynamic lockscreen blur" +msgstr "Ativar o desfoque dinâmico da tela de bloqueio" -#: Settings.ui.h:18 Settings4.ui.h:19 -msgid "Blur can improve readability of login prompt" -msgstr "Desfoque pode melhorar a legibilidade da tela de login" +#: ui/Settings4.ui.h:16 +msgid "Blur can improve readability" +msgstr "Desfoque pode melhorar a legibilidade" -#: Settings.ui.h:19 Settings4.ui.h:20 +#: ui/Settings4.ui.h:17 msgid "Background blur intensity" msgstr "Intensidade do desfoque de fundo" -#: Settings.ui.h:20 Settings4.ui.h:21 +#: ui/Settings4.ui.h:18 msgid "Can improve contrast of login prompt" msgstr "Pode melhorar o contraste da tela de login" -#: Settings.ui.h:21 Settings4.ui.h:22 +#: ui/Settings4.ui.h:19 msgid "Background brightness" msgstr "Brilho do fundo" -#: Settings.ui.h:22 Settings4.ui.h:23 +#: ui/Settings4.ui.h:20 msgid "Presets" msgstr "Predefinições" -#: Settings.ui.h:23 Settings4.ui.h:24 -msgid "Commonly used presets" -msgstr "Predefinições comumente usadas" - -#: Settings.ui.h:24 Settings4.ui.h:25 +#: ui/Settings4.ui.h:21 msgid "No blur, slight dim" msgstr "Sem desfoque, um pouco escuro" -#: Settings.ui.h:25 Settings4.ui.h:26 +#: ui/Settings4.ui.h:22 msgid "GNOME default" msgstr "Padrão GNOME" -#: Settings.ui.h:26 Settings4.ui.h:27 +#: ui/Settings4.ui.h:23 msgid "Slight blur, slight dim" msgstr "Desfoque leve, um pouco escuro" -#: Settings.ui.h:27 Settings4.ui.h:28 +#: ui/Settings4.ui.h:24 msgid "Lock Screen" msgstr "Tela de bloqueio" -#: Settings.ui.h:28 Settings4.ui.h:29 +#: ui/Settings4.ui.h:25 +msgid "Enable logging to system journal" +msgstr "Ativar o registro no journal do sistema" + +#: ui/Settings4.ui.h:26 +msgid "Debug logging" +msgstr "Depurar o registro" + +#: ui/Settings4.ui.h:27 +msgid "Switch to new images when available (unless on random mode)" +msgstr "" +"Trocar para novas imagens quando disponíveis (a não ser em modo aleatório)" + +#: ui/Settings4.ui.h:28 extension.js:153 +msgid "Always show new images" +msgstr "Sempre mostre novas imagens" + +#: ui/Settings4.ui.h:29 +msgid "Some newer features may be unstable on Wayland" +msgstr "Algumas funcionalidades novas podem ser instáveis no Wayland" + +#: ui/Settings4.ui.h:30 +msgid "Enable all features on Wayland" +msgstr "Ativar todas as funcionalidades no Wayland" + +#: ui/Settings4.ui.h:31 +msgid "Screen resolution" +msgstr "Resolução de tela" + +#: ui/Settings4.ui.h:32 +msgid "Override automatic resolution selection" +msgstr "Substituir a seleção de resolução automática" + +#: ui/Settings4.ui.h:33 +msgid "Manually adjust random interval (seconds)" +msgstr "Manualmente ajusta o intervalo de aleatoriedade (segundos)" + +#: ui/Settings4.ui.h:34 +msgid "Random interval" +msgstr "Intervalo de aleatoriedade" + +#: ui/Settings4.ui.h:35 +msgid "Import Bing Wallpaper data" +msgstr "Importar dados de papel de parede Bing" + +#: ui/Settings4.ui.h:36 +msgid "Import previously exported JSON data from wallpaper directory" +msgstr "" +"Importar previamente exportado dados JSON do diretório de papel de parede" + +#: ui/Settings4.ui.h:37 +msgid "Import" +msgstr "Importar" + +#: ui/Settings4.ui.h:38 +msgid "Export Bing Wallpaper data" +msgstr "Exportar dados de papel de parede Bing" + +#: ui/Settings4.ui.h:39 +msgid "Export JSON data to wallpaper dir for backup or data migration" +msgstr "" +"Exportar dados JSON para diretório de papel de parede para salvaguardar ou " +"migração de dados" + +#: ui/Settings4.ui.h:40 +msgid "Export" +msgstr "Exportar" + +#: ui/Settings4.ui.h:41 +msgid "Always export Bing data" +msgstr "Sempre exporta dados Bing" + +#: ui/Settings4.ui.h:42 +msgid "Export Bing JSON whenever data changes" +msgstr "Exportar JSON Bing sempre que alterar dados" + +#: ui/Settings4.ui.h:43 +msgid "Debug options" +msgstr "Opções de depuração" + +#: ui/Settings4.ui.h:44 +msgid "Gallery" +msgstr "Galeria" + +#: ui/Settings4.ui.h:45 msgid "New wallpaper images everyday from Bing" msgstr "Novas imagens de papel de parede todos os dias do Bing" -#: Settings.ui.h:29 Settings4.ui.h:30 -msgid "Gnome shell extension version " -msgstr "Versão da extensão Gnome shell " +#: ui/Settings4.ui.h:46 +msgid "GNOME shell extension version " +msgstr "Versão da extensão GNOME shell " -#: Settings.ui.h:30 Settings4.ui.h:31 -msgid "https://github.com/neffo/bing-wallpaper-gnome-extension" -msgstr "https://github.com/neffo/bing-wallpaper-gnome-extension" - -#: Settings.ui.h:31 Settings4.ui.h:32 +#: ui/Settings4.ui.h:47 msgid "Maintained by Michael Carroll" msgstr "Mantida por Michael Carroll" -#: Settings.ui.h:32 Settings4.ui.h:33 +#: ui/Settings4.ui.h:48 msgid "" -"Show your support to the author on Flattr or Github " +"Show your support to the author on Flattr or Github " "Sponsors." msgstr "" "Mostre seu apoio ao autor no Flattr ou Patrocinadores do " "Github." -#: Settings.ui.h:33 Settings4.ui.h:34 +#: ui/Settings4.ui.h:49 msgid "Changes since last version" msgstr "Alterações desde a última versão" -#: Settings.ui.h:34 Settings4.ui.h:35 -msgid "Based on NASA APOD Gnome shell extension by Elia Argentieri" -msgstr "Baseado na extensão NASA APOD Gnome shell pela Elia Argentieri" +#: ui/Settings4.ui.h:50 +msgid "Based on NASA APOD GNOME shell extension by Elia Argentieri" +msgstr "Baseado na extensão NASA APOD GNOME shell pela Elia Argentieri" -#: Settings.ui.h:35 Settings4.ui.h:36 +#: ui/Settings4.ui.h:51 msgid "" "This program comes with ABSOLUTELY NO WARRANTY.\n" "See the GNU General " @@ -170,106 +241,198 @@ msgstr "" "Veja a GNU General " "Public License, versão 3 ou posterior para mais detalhes" -#: Settings.ui.h:37 Settings4.ui.h:38 +#: ui/Settings4.ui.h:53 msgid "About" msgstr "Sobre" -#: Settings4.ui.h:8 -msgid "Open folder" -msgstr "Abrir pasta" +#: ui/carousel4.ui.h:1 +msgid "Favorite" +msgstr "Favorito" + +#: ui/carousel4.ui.h:2 +msgid "Apply" +msgstr "Aplicar" + +#: ui/carousel4.ui.h:3 +msgid "View" +msgstr "Visualizar" + +#: ui/carousel4.ui.h:4 +msgid "Info" +msgstr "Informação" + +#: ui/carousel4.ui.h:5 +msgid "Delete" +msgstr "Apagar" + +#: ui/carousel4.ui.h:6 +msgid "" +msgstr "" + +#: ui/carousel4.ui.h:7 +msgid "Set random mode" +msgstr "Definir modo aleatório" + +#: ui/carousel4.ui.h:8 +msgid "Load image gallery" +msgstr "Carrega a galeria de imagem" + +#: ui/intervals.utils.js.h:2 +msgid "on the hour" +msgstr "de hora em hora" + +#: ui/intervals.utils.js.h:5 +msgid "every day at midnight" +msgstr "todo dia à meia-noite" + +#: ui/intervals.utils.js.h:8 +msgid "every Sunday at midnight" +msgstr "todo domingo à meia-noite" -#: extension.js:117 +#: extension.js:130 msgid "" msgstr "" -#: extension.js:119 extension.js:121 extension.js:123 +#: extension.js:131 extension.js:132 extension.js:142 extension.js:144 msgid "Awaiting refresh..." msgstr "Aguardando atualização..." -#: extension.js:126 +#: extension.js:133 msgid "Copy image to clipboard" msgstr "Copiar imagem para área de transferência" -#: extension.js:127 +#: extension.js:134 msgid "Copy image URL to clipboard" msgstr "Copiar URL da imagem para área de transferência" -#: extension.js:128 +#: extension.js:135 msgid "Open image folder" msgstr "Abrir pasta de imagens" -#: extension.js:131 +#: extension.js:137 +msgid "Set lock screen image" +msgstr "Definir imagem da tela de bloqueio" + +#: extension.js:138 msgid "Refresh Now" msgstr "Atualizar agora" -#: extension.js:137 -msgid "Thumbnail disabled on Wayland" -msgstr "Miniaturas desativadas no Wayland" +#: extension.js:140 +msgid "Open in image viewer" +msgstr "Abrir no visualizador de imagem" -#: extension.js:203 -msgid "Next refresh" -msgstr "Próxima atualização" +#: extension.js:141 +msgid "Open Bing image information page" +msgstr "Abrir página de informação de imagem Bing" -#: extension.js:490 extension.js:527 -msgid "Bing Wallpaper of the Day for" -msgstr "Papel de parede do dia para" +#: extension.js:150 +msgid "Quick settings" +msgstr "Configurações rápidas" -#: extension.js:495 -msgid "Set as wallpaper" -msgstr "Definir como papel de parede" +#: extension.js:154 +msgid "Image shuffle mode" +msgstr "Modo embaralhar imagem" -#: extension.js:498 -msgid "More info on Bing.com" -msgstr "Mais informações no Bing.com" +#: extension.js:155 +msgid "Image shuffle only favourites" +msgstr "Embaralha apenas imagens favoritas" -#: extension.js:553 -msgid "No wallpaper available" -msgstr "Nenhum papel de parede disponível" +#: extension.js:157 +msgid "Show image count" +msgstr "Exibir contador de imagem" -#: extension.js:554 -msgid "No picture for today." -msgstr "Nenhuma imagem para hoje." +#: extension.js:158 +msgid "Image shuffle only UHD resolutions" +msgstr "Embaralha imagem somente em resolução UHD" -#: prefs.js:173 -msgid "Most recent image" -msgstr "Imagem mais recente" +#: extension.js:321 +msgid "Next refresh" +msgstr "Próxima atualização" -#: prefs.js:174 -msgid "Random image" -msgstr "Imagem aleatória" +#: extension.js:323 +msgid "Last refresh" +msgstr "Última atualização" -#: prefs.js:190 prefs.js:206 -msgid "Disabled on current GNOME version" -msgstr "Desabilitada na versão atual do GNOME" +#: extension.js:326 +msgid "Next shuffle" +msgstr "Próximo embaralhamento" -#: utils.js:139 -msgid "Fetching data..." -msgstr "Buscando dados..." +#: extension.js:801 extension.js:875 +msgid "Bing Wallpaper of the Day for" +msgstr "Papel de parede do dia para" -#: utils.js:150 -msgid "Market not available in your region" -msgstr "Mercado não disponível na sua região" +#: extension.js:913 +msgid "No wallpaper available" +msgstr "Nenhum papel de parede disponível" -#: utils.js:154 -msgid "A network error occured" -msgstr "Ocorreu um erro de rede" +#: extension.js:914 +msgid "No picture for today." +msgstr "Nenhuma imagem para hoje." -#: utils.js:159 -msgid "Too many requests in 5 seconds" -msgstr "Muitas requisições realizadas em 5 segundos" +#: prefs.js:156 +msgid "Select folder" +msgstr "Selecionar pasta" -#: utils.js:186 -msgid "No change log found for this release" -msgstr "Não foram encontrados registros de alterações para esta versão" +#: utils.js:127 +msgid "Error fetching change log: " +msgstr "Erro ao obter o registro de alterações" -#: utils.js:366 utils.js:369 +#: utils.js:405 utils.js:408 msgid "minutes" msgstr "minutos" -#: utils.js:372 +#: utils.js:411 msgid "days" msgstr "dias" -#: utils.js:375 +#: utils.js:414 msgid "hours" msgstr "horas" + +#~ msgid "Delete previously downloaded wallpapers" +#~ msgstr "Excluir papéis de parede baixados anteriormente" + +#~ msgid "Days to store wallpapers before deleting" +#~ msgstr "Dias para armazenar papéis de parede antes de excluir" + +#~ msgid "Default is English - United States" +#~ msgstr "O padrão é inglês - Estados Unidos" + +#~ msgid "Use custom blur and brightness" +#~ msgstr "Usar desfoque e brilho personalizados" + +#~ msgid "Override GDM3 lockscreen effects" +#~ msgstr "Sobrescrever efeitos de bloqueio de tela GDM3" + +#~ msgid "Commonly used presets" +#~ msgstr "Predefinições comumente usadas" + +#~ msgid "https://github.com/neffo/bing-wallpaper-gnome-extension" +#~ msgstr "https://github.com/neffo/bing-wallpaper-gnome-extension" + +#~ msgid "Set as wallpaper" +#~ msgstr "Definir como papel de parede" + +#~ msgid "More info on Bing.com" +#~ msgstr "Mais informações no Bing.com" + +#~ msgid "Most recent image" +#~ msgstr "Imagem mais recente" + +#~ msgid "Disabled on current GNOME version" +#~ msgstr "Desabilitada na versão atual do GNOME" + +#~ msgid "Fetching data..." +#~ msgstr "Buscando dados..." + +#~ msgid "Market not available in your region" +#~ msgstr "Mercado não disponível na sua região" + +#~ msgid "A network error occured" +#~ msgstr "Ocorreu um erro de rede" + +#~ msgid "Too many requests in 5 seconds" +#~ msgstr "Muitas requisições realizadas em 5 segundos" + +#~ msgid "No change log found for this release" +#~ msgstr "Não foram encontrados registros de alterações para esta versão" diff --git a/metadata.json b/metadata.json index e35c0675..e7f8505f 100644 --- a/metadata.json +++ b/metadata.json @@ -1,10 +1,10 @@ { "uuid": "BingWallpaper@ineffable-gmail.com", - "shell-version": ["45"], + "shell-version": ["45", "46"], "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": "48", + "version": "49", "url": "https://github.com/neffo/bing-wallpaper-gnome-extension", "gettext-domain": "BingWallpaper" } diff --git a/prefs.js b/prefs.js index 4986c7aa..a2a1c201 100644 --- a/prefs.js +++ b/prefs.js @@ -21,19 +21,25 @@ const BingImageURL = Utils.BingImageURL; var DESKTOP_SCHEMA = 'org.gnome.desktop.background'; -var PREFS_DEFAULT_WIDTH = 950; -var PREFS_DEFAULT_HEIGHT = 950; +// this is pretty wide because of the size of the gallery +var PREFS_DEFAULT_WIDTH = 750; +var PREFS_DEFAULT_HEIGHT = 750; export default class BingWallpaperExtensionPreferences extends ExtensionPreferences { fillPreferencesWindow(window) { // formally globals let settings = this.getSettings(Utils.BING_SCHEMA); - let desktop_settings = this.getSettings(Utils.DESKTOP_SCHEMA); + //let desktop_settings = this.getSettings(Utils.DESKTOP_SCHEMA); window.set_default_size(PREFS_DEFAULT_WIDTH, PREFS_DEFAULT_HEIGHT); - let icon_image = null; + /*let icon_image = null;*/ let provider = new Gtk.CssProvider(); + provider.load_from_path(this.dir.get_path() + '/ui/prefs.css'); + Gtk.StyleContext.add_provider_for_display( + Gdk.Display.get_default(), + provider, + Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); let carousel = null; let httpSession = null; @@ -42,55 +48,137 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen if (settings.get_boolean('debug-logging')) console.log("BingWallpaper extension: " + msg); // disable to keep the noise down in journal } - - // Prepare labels and controls + let buildable = new Gtk.Builder(); // GTK4 removes some properties, and builder breaks when it sees them - buildable.add_from_file( this.dir.get_path() + '/ui/Settings4.ui' ); - provider.load_from_path(this.dir.get_path() + '/ui/prefs.css'); - Gtk.StyleContext.add_provider_for_display( - Gdk.Display.get_default(), - provider, - Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + buildable.add_from_file( this.dir.get_path() + '/ui/prefsadw.ui' ); + + // adw or gtk objects we'll attach to below + const settings_page = buildable.get_object('settings_page'); + const hideSwitch = buildable.get_object('hideSwitch'); + const notifySwitch = buildable.get_object('notifySwitch'); + const iconEntry = buildable.get_object('iconEntry'); + const bgSwitch = buildable.get_object('bgSwitch'); + const shuffleSwitch = buildable.get_object('shuffleSwitch'); + const shuffleInterval = buildable.get_object('shuffleInterval'); + const folderRow = buildable.get_object('folderRow'); + const lockscreen_page = buildable.get_object('lockscreen_page'); + const overrideSwitch = buildable.get_object('overrideSwitch'); + const blurPresets = buildable.get_object('blurPresets'); + const strengthEntry = buildable.get_object('strengthEntry'); + const brightnessEntry = buildable.get_object('brightnessEntry'); + const blurAdjustment = buildable.get_object('blurAdjustment'); + const brightnessAdjustment = buildable.get_object('brightnessAdjustment'); + const resolutionEntry = buildable.get_object('resolutionEntry'); + const debugSwitch = buildable.get_object('debug_switch'); + const revertSwitch = buildable.get_object('revert_switch'); + const trash_purge_switch = buildable.get_object('trash_purge_switch'); + const always_export_switch = buildable.get_object('always_export_switch'); + const gallery_page = buildable.get_object('gallery_page'); + const carouselFlowBox = buildable.get_object('carouselFlowBox'); + const randomIntervalEntry = buildable.get_object('entry_random_interval'); + const debug_page = buildable.get_object('debug_page'); + const json_actionrow = buildable.get_object('json_actionrow'); + const about_page = buildable.get_object('about_page'); + const version_button = buildable.get_object('version_button'); + const change_log = buildable.get_object('change_log'); + + window.add(settings_page); + window.add(lockscreen_page); + window.add(gallery_page); + window.add(debug_page); + window.add(about_page); + + iconEntry.set_value(1+Utils.icon_list.indexOf(settings.get_string('icon-name'))); + + // shuffle intervals + const shuffleIntervals = new Gtk.StringList; + Utils.randomIntervals.forEach((x) => { + shuffleIntervals.append(_(x.title)); + }); + + shuffleInterval.set_model(shuffleIntervals); + shuffleInterval.set_selected(Utils.randomIntervals.map( e => e.value).indexOf(settings.get_string('random-interval-mode'))); + + // add wallpaper folder open and change buttons + const openBtn = new Gtk.Button( { + child: new Adw.ButtonContent({ + icon_name: 'folder-pictures-symbolic', + label: _('Open folder'), + },), + valign: Gtk.Align.CENTER, + halign: Gtk.Align.CENTER, + }); + const changeBtn = new Gtk.Button( { + child: new Adw.ButtonContent({ + icon_name: 'folder-download-symbolic', + label: _('Change folder'), + },), + valign: Gtk.Align.CENTER, + halign: Gtk.Align.CENTER, + }); + + folderRow.add_suffix(openBtn); + folderRow.add_suffix(changeBtn); + + blurAdjustment.set_value(settings.get_int('lockscreen-blur-strength')); + brightnessAdjustment.set_value(settings.get_int('lockscreen-blur-brightness')); + + const defaultBtn = new Gtk.Button( { + child: new Adw.ButtonContent({ + icon_name: 'emblem-default-symbolic', + label: _('Default'), + },), + valign: Gtk.Align.CENTER, + halign: Gtk.Align.CENTER, + }); + const noBlurBtn = new Gtk.Button( { + child: new Adw.ButtonContent({ + icon_name: 'emblem-default-symbolic', + label: _('No blur, slight dim'), + },), + valign: Gtk.Align.CENTER, + halign: Gtk.Align.CENTER, + }); + const slightBlurBtn = new Gtk.Button( { + child: new Adw.ButtonContent({ + icon_name: 'emblem-default-symbolic', + label: _('Slight blur & dim'), + },), + valign: Gtk.Align.CENTER, + halign: Gtk.Align.CENTER, + }); - let box = buildable.get_object('prefs_widget'); - - // fix size of prefs window in GNOME shell 40+ (but super racy, so is unreliable) - - buildable.get_object('extension_version').set_text(this.metadata.version.toString()); - buildable.get_object('extension_name').set_text(this.metadata.name.toString()); - - // assign variables to UI objects we've loaded - let hideSwitch = buildable.get_object('hide'); - let iconEntry = buildable.get_object('icon'); - let notifySwitch = buildable.get_object('notify'); - let bgSwitch = buildable.get_object('background'); - let styleEntry = buildable.get_object('background_style'); - let fileChooserBtn = buildable.get_object('download_folder'); - let fileChooser = buildable.get_object('file_chooser'); // this should only exist on Gtk4 - let folderOpenBtn = buildable.get_object('button_open_download_folder'); - let marketEntry = buildable.get_object('market'); - let resolutionEntry = buildable.get_object('resolution'); - let historyEntry = buildable.get_object('history'); - icon_image = buildable.get_object('icon_image'); - let overrideSwitch = buildable.get_object('lockscreen_override'); - let strengthEntry = buildable.get_object('entry_strength'); - let brightnessEntry = buildable.get_object('entry_brightness'); - let debugSwitch = buildable.get_object('debug_switch'); - let revertSwitch = buildable.get_object('revert_switch'); - let unsafeSwitch = buildable.get_object('unsafe_switch'); - let randomIntervalEntry = buildable.get_object('entry_random_interval'); - let change_log = buildable.get_object('change_log'); - let buttonGDMdefault = buildable.get_object('button_default_gnome'); - let buttonnoblur = buildable.get_object('button_no_blur'); - let buttonslightblur = buildable.get_object('button_slight_blur'); - let buttonImportData = buildable.get_object('button_json_import'); - let buttonExportData = buildable.get_object('button_json_export'); - let switchAlwaysExport = buildable.get_object('always_export_switch'); - let switchEnableShuffle = buildable.get_object('shuffle_enabled_switch'); - let entryShuffleMode = buildable.get_object('shuffle_mode_combo'); - let carouselFlowBox = (Gtk.get_major_version() == 4) ? buildable.get_object('carouselFlowBox'): null; + // add to presets row + blurPresets.add_suffix(defaultBtn); + blurPresets.add_suffix(noBlurBtn); + blurPresets.add_suffix(slightBlurBtn); + + randomIntervalEntry.set_value(settings.get_int('random-interval')); + + // these buttons either export or import saved JSON data + const buttonImportData = new Gtk.Button( { + child: new Adw.ButtonContent({ + icon_name: 'document-send-symbolic', + label: _('Import'), + },), + valign: Gtk.Align.CENTER, + halign: Gtk.Align.CENTER, + }); + const buttonExportData = new Gtk.Button( { + child: new Adw.ButtonContent({ + icon_name: 'document-save-symbolic', + label: _('Export'), + },), + valign: Gtk.Align.CENTER, + halign: Gtk.Align.CENTER, + }); + + json_actionrow.add_suffix(buttonImportData); + json_actionrow.add_suffix(buttonExportData); + version_button.set_label(this.metadata.version.toString()); + try { httpSession = new Soup.Session(); httpSession.user_agent = 'User-Agent: Mozilla/5.0 (X11; GNOME Shell/' + Config.PACKAGE_VERSION + '; Linux x86_64; +https://github.com/neffo/bing-wallpaper-gnome-extension ) BingWallpaper Gnome Extension/' + this.metadata.version; @@ -98,43 +186,42 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen catch (e) { log("Error creating httpSession: " + e); } - + const icon_image = buildable.get_object('icon_image'); + // check that these are valid (can be edited through dconf-editor) Utils.validate_resolution(settings); Utils.validate_icon(settings, this.path, icon_image); + Utils.validate_interval(settings); // Indicator & notifications settings.bind('hide', hideSwitch, 'active', Gio.SettingsBindFlags.DEFAULT); settings.bind('notify', notifySwitch, 'active', Gio.SettingsBindFlags.DEFAULT); - - // add markets to dropdown list (aka a GtkComboText) - Utils.icon_list.forEach((iconname, index) => { - iconEntry.append(iconname, iconname); - }); - - // user selectable indicator icons - settings.bind('icon-name', iconEntry, 'active_id', Gio.SettingsBindFlags.DEFAULT); settings.connect('changed::icon-name', () => { Utils.validate_icon(settings, this.path, icon_image); + iconEntry.set_value(1 + Utils.icon_list.indexOf(settings.get_string('icon-name'))); + }); + + iconEntry.connect('output', () => { + settings.set_string('icon-name', Utils.icon_list[iconEntry.get_value()-1]); }); - iconEntry.set_active_id(settings.get_string('icon-name')); // connect switches to settings changes settings.bind('set-background', bgSwitch, 'active', Gio.SettingsBindFlags.DEFAULT); settings.bind('debug-logging', debugSwitch, 'active', Gio.SettingsBindFlags.DEFAULT); settings.bind('revert-to-current-image', revertSwitch, 'active', Gio.SettingsBindFlags.DEFAULT); - settings.bind('override-unsafe-wayland', unsafeSwitch, 'active', Gio.SettingsBindFlags.DEFAULT); + //settings.bind('override-unsafe-wayland', unsafeSwitch, 'active', Gio.SettingsBindFlags.DEFAULT); settings.bind('random-interval', randomIntervalEntry, 'value', Gio.SettingsBindFlags.DEFAULT); - settings.bind('always-export-bing-json', switchAlwaysExport, 'active', Gio.SettingsBindFlags.DEFAULT); + settings.bind('trash-deletes-images', trash_purge_switch, 'active', Gio.SettingsBindFlags.DEFAULT); + settings.bind('always-export-bing-json', always_export_switch, 'active', Gio.SettingsBindFlags.DEFAULT); // button opens Nautilus at our image folder - folderOpenBtn.connect('clicked', (widget) => { + openBtn.connect('clicked', (widget) => { Utils.openImageFolder(settings); }); - + // we populate the tab (gtk4+, gnome 40+), this was previously a button to open a new window in gtk3 carousel = new Carousel(settings, null, null, carouselFlowBox, this.dir.get_path()); // auto load carousel - + // this is intended for migrating image folders between computers (or even sharing) or backups // we export the Bing JSON data to the image directory, so this folder becomes portable buttonImportData.connect('clicked', () => { @@ -144,104 +231,66 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen Utils.exportBingJSON(settings); }); - //download folder - fileChooserBtn.set_label(Utils.getWallpaperDir(settings)); - - fileChooserBtn.connect('clicked', (widget) => { - let parent = widget.get_root(); - let curWallpaperDir = Gio.File.new_for_path(Utils.getWallpaperDir(settings)); - fileChooser.set_current_folder(curWallpaperDir.get_parent()); - fileChooser.set_action(Gtk.FileChooserAction.SELECT_FOLDER); - fileChooser.set_transient_for(parent); - fileChooser.set_accept_label(_('Select folder')); - fileChooser.show(); - }); - - fileChooser.connect('response', (widget, response) => { - if (response !== Gtk.ResponseType.ACCEPT) { - return; - } - let fileURI = fileChooser.get_file().get_path().replace('file://', ''); - fileChooserBtn.set_label(fileURI); - Utils.moveImagesToNewFolder(settings, Utils.getWallpaperDir(settings), fileURI); - Utils.setWallpaperDir(settings, fileURI); + // change wallpaper button + const dirChooser = new Gtk.FileDialog( { + accept_label: "Select", + modal: true, + title: _("Select wallpaper download folder"), }); - // in Gtk 4 instead we use a DropDown, but we need to treat it a bit special - let market_grid = buildable.get_object('market_grid'); - marketEntry = Gtk.DropDown.new_from_strings(Utils.marketName); - marketEntry.set_selected(Utils.markets.indexOf(settings.get_string('market'))); - market_grid.attach(marketEntry, 1, 0, 1, 2); - marketEntry.connect('notify::selected-item', () => { - let id = marketEntry.get_selected(); - settings.set_string('market', Utils.markets[id]); - }); - - settings.connect('changed::market', () => { - marketEntry.set_selected(Utils.markets.indexOf(settings.get_string('market'))); - }); + changeBtn.connect('clicked', (widget) => { + dirChooser.set_initial_folder(Gio.File.new_for_path(Utils.getWallpaperDir(settings))); + dirChooser.select_folder(window, null, (self, res) => { + let new_path = self.select_folder_finish(res).get_uri().replace('file://', ''); + log(new_path); + Utils.moveImagesToNewFolder(settings, Utils.getWallpaperDir(settings), new_path); + Utils.setWallpaperDir(settings, new_path); + }); - settings.connect('changed::download-folder', () => { - fileChooserBtn.set_label(Utils.getWallpaperDir(settings)); }); - // Resolution + const resolutionModel = new Gtk.StringList(); Utils.resolutions.forEach((res) => { // add res to dropdown list (aka a GtkComboText) - resolutionEntry.append(res, res); + resolutionModel.append(res); }); + resolutionEntry.set_model(resolutionModel); - settings.bind('resolution', resolutionEntry, 'active_id', Gio.SettingsBindFlags.DEFAULT); + settings.connect('changed::resolution', () => { + resolutionEntry.set_selected(Utils.resolutions.map( e => e.value).indexOf(settings.get_string('resolution'))); + }); settings.connect('changed::resolution', () => { Utils.validate_resolution(settings); }); // shuffle modes - settings.bind('random-mode-enabled', switchEnableShuffle, 'active', Gio.SettingsBindFlags.DEFAULT); - Utils.randomIntervals.forEach((x) => { - entryShuffleMode.append(x.value, _(x.title)); - }); - settings.bind('random-interval-mode', entryShuffleMode, 'active_id', Gio.SettingsBindFlags.DEFAULT); + settings.bind('random-mode-enabled', shuffleSwitch, 'active', Gio.SettingsBindFlags.DEFAULT); + /*settings.bind('random-interval-mode', entryShuffleMode, 'active_id', Gio.SettingsBindFlags.DEFAULT);*/ - // selected image can no longer be changed through a dropdown (didn't scale) - settings.bind('selected-image', historyEntry, 'label', Gio.SettingsBindFlags.DEFAULT); - settings.connect('changed::selected-image', () => { - Utils.validate_imagename(settings); - }); - - // background styles (e.g. zoom or span) - Utils.backgroundStyle.forEach((style) => { - styleEntry.append(style, style); + settings.connect('changed::random-interval-mode', () => { + shuffleInterval.set_selected(Utils.randomIntervals.map( e => e.value).indexOf(settings.get_string('random-interval-mode'))); }); - desktop_settings.bind('picture-options', styleEntry, 'active_id', Gio.SettingsBindFlags.DEFAULT); - + // GDM3 lockscreen blur override settings.bind('override-lockscreen-blur', overrideSwitch, 'active', Gio.SettingsBindFlags.DEFAULT); settings.bind('lockscreen-blur-strength', strengthEntry, 'value', Gio.SettingsBindFlags.DEFAULT); settings.bind('lockscreen-blur-brightness', brightnessEntry, 'value', Gio.SettingsBindFlags.DEFAULT); // add a couple of preset buttons - buttonGDMdefault.connect('clicked', (widget) => { + defaultBtn.connect('clicked', (widget) => { Utils.set_blur_preset(settings, Utils.PRESET_GNOME_DEFAULT); }); - buttonnoblur.connect('clicked', (widget) => { + noBlurBtn.connect('clicked', (widget) => { Utils.set_blur_preset(settings, Utils.PRESET_NO_BLUR); }); - buttonslightblur.connect('clicked', (widget) => { + slightBlurBtn.connect('clicked', (widget) => { Utils.set_blur_preset(settings, Utils.PRESET_SLIGHT_BLUR); }); - - // fetch + + // fetch change log (on about page) + if (httpSession) Utils.fetch_change_log(this.metadata.version.toString(), change_log, httpSession); - - const page = new Adw.PreferencesPage(); - const group = new Adw.PreferencesGroup(); - - group.add(box); - page.add(group); - - window.add(page); } } diff --git a/schemas/gschemas.compiled b/schemas/gschemas.compiled index 77f335cd..bdd63d22 100644 Binary files a/schemas/gschemas.compiled and b/schemas/gschemas.compiled differ diff --git a/schemas/org.gnome.shell.extensions.bingwallpaper.gschema.xml b/schemas/org.gnome.shell.extensions.bingwallpaper.gschema.xml index c457c1d0..b01c105c 100644 --- a/schemas/org.gnome.shell.extensions.bingwallpaper.gschema.xml +++ b/schemas/org.gnome.shell.extensions.bingwallpaper.gschema.xml @@ -211,7 +211,7 @@ - false + true Trash deletes images or just marks as bad diff --git a/ui/Settings4.ui b/ui/Settings4.ui deleted file mode 100644 index 073a3bff..00000000 --- a/ui/Settings4.ui +++ /dev/null @@ -1,1451 +0,0 @@ - - - - - - 50 - 1 - 10 - - - 100 - 5 - 10 - - - 7 - 1 - 2 - - - 300 - 604800 - 300 - 3600 - - - Bing Wallpaper pictures folder - 0 - select-folder - 1 - - - - 120 - - - 0 - 0 - 0 - 500 - - - - - 0 - 12 - 12 - 12 - 12 - vertical - 12 - 0 - - - 0 - - - 0 - none - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - Hide the indicator - 1 - - 0 - 0 - - - - - - end - 1 - - 1 - 0 - - - - - - - - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - Indicator icon - 1 - - 0 - 0 - 2 - - - - - - 0 - end - - 1 - 1 - 1 - - - - - - 32 - 32 - 0 - end - 1 - ../icons/bing-symbolic.svg - icon_image_black_bg - - 1 - 0 - 1 - - - - - - - - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - Enable desktop notifications - 1 - - 0 - 0 - - - - - - end - 1 - - 1 - 0 - - - - - - - - - - - - - - - - - 0 - - - 0 - none - - - - - 0 - 12 - 12 - 12 - 12 - - - 0 - Set background image - - 0 - 0 - - - - - - end - 1 - - 1 - 0 - - - - - - - - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Background style option - - 0 - 0 - - - - - - - 1 - 0 - 1 - - - - - - - - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - Download folder - - 0 - 0 - - - - - - True - False - end - false - Bing Wallpaper pictures folder - - 1 - 0 - - - - - - Open folder - True - True - - 2 - 0 - - - - - - - - - - - - - - - - - 0 - - - 0 - none - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Selected image - - 0 - 0 - - - - - - - 1 - 0 - 1 - - - - - - - - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Shuffle enabled - - 0 - 0 - - - - - - end - 1 - - 1 - 0 - - - - - - - - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Shuffle mode - - 0 - 0 - - - - - - - 1 - 0 - 1 - - - - - - - - - - - - - - - - - 0 - - - 0 - none - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Bing locale - 1 - - 0 - 0 - - - - - - 0 - start - 0 - - - - 0 - 1 - - - - - - - - - - - - - - - - - - - 0 - Settings - - - - - - - 1 - - - 0 - 12 - 12 - 12 - 12 - vertical - 12 - - - 0 - 0 - - - 0 - none - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - end - - 1 - 0 - - - - - - 0 - start - 1 - Dynamically switches blur on GDM3 lock screen - - - 0 - 1 - - - - - - 0 - start - 1 - Enable dynamic lockscreen blur - 1 - - 0 - 0 - - - - - - - - - - - - - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Blur can improve readability - - - 0 - 1 - - - - - - 0 - start - 1 - Background blur intensity - - 0 - 0 - - - - - - adjustment_blur - 1 - - 1 - 0 - - - - - - - - - - - - - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Can improve contrast of login prompt - - - 0 - 1 - - - - - - 0 - start - 1 - Background brightness - - 0 - 0 - - - - - - adjustment_brightness - 1 - - 1 - 0 - - - - - - - - - - - - - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Presets - 1 - - 0 - 0 - - - - - - No blur, slight dim - 1 - - 1 - 3 - - - - - - GNOME default - 1 - - 1 - 2 - - - - - - Slight blur, slight dim - 1 - - 1 - 4 - - - - - - - - - - - - - - - - - - - - - - 0 - Lock Screen - - - - - - - 2 - - - 0 - 12 - 12 - 12 - 12 - vertical - 12 - - - 0 - 0 - - - 0 - none - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - end - - 1 - 0 - - - - - - 0 - start - 1 - Enable logging to system journal - - - 0 - 1 - - - - - - 0 - start - 1 - Debug logging - 1 - - 0 - 0 - - - - - - - - - - - - - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Switch to new images when available (unless on random mode) - - - 0 - 1 - - - - - - 0 - start - 1 - Always show new images - 1 - - 0 - 0 - - - - - - end - - 1 - 0 - - - - - - - - - - - - - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Some newer features may be unstable on Wayland - - - 0 - 1 - - - - - - 0 - start - 1 - Enable all features on Wayland - 1 - - 0 - 0 - - - - - - end - - 1 - 0 - - - - - - - - - - - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Screen resolution - 1 - - 0 - 0 - - - - - - 0 - start - Override automatic resolution selection - - - 0 - 1 - - - - - - - 1 - 0 - 2 - - - - - - - - - - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Manually adjust random interval (seconds) - - - 0 - 1 - - - - - - 0 - start - 1 - Random interval - - 0 - 0 - - - - - - adjustment_random_interval - 1 - - 1 - 0 - - - - - - - - - - - - - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Import Bing Wallpaper data - 1 - - 0 - 0 - - - - - - 0 - start - 1 - Import previously exported JSON data from wallpaper directory - - - 0 - 1 - - - - - - Import - 1 - - 1 - 1 - - - - - - - - - - - - - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Export Bing Wallpaper data - 1 - - 0 - 0 - - - - - - 0 - start - 1 - Export JSON data to wallpaper dir for backup or data migration - - - 0 - 1 - - - - - - Export - 1 - - 1 - 1 - - - - - - - - - - - - - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Always export Bing data - 1 - - 0 - 0 - - - - - - 0 - start - 1 - Export Bing JSON whenever data changes - - - - 0 - 1 - - - - - - end - - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - 0 - Debug options - - - - - - - 3 - - - 0 - vertical - - - - 0 - 500 - 0 - 0 - - - 0 - center - 1 - 2 - 2 - 2 - 2 - - - - - - - - - 0 - Gallery - - - - - - - 4 - - - 0 - - - 1 - 0 - vertical - 5 - - - - 0 - Bing Wallpaper - - - - - - - - 0 - New wallpaper images everyday from Bing - center - 1 - - - - - 0 - center - - - - 0 - end - GNOME shell extension version - - - - - 0 - start - ... - - - - - - - https://github.com/neffo/bing-wallpaper-gnome-extension - 0 - 1 - center - https://github.com/neffo/bing-wallpaper-gnome-extension - - - - - 0 - center - vertical - 5 - - - 0 - Maintained by Michael Carroll - - - - - 0 - ineffable@gmail.com - 1 - - - - - 0 - 36 - 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>. - 1 - - - - - 0 - 36 - - 1 - - Changes since last version - 1 - - - - - 0 - 36 - Based on NASA APOD GNOME shell extension by Elia Argentieri - center - 1 - - - - - - - - - - 0 - 0 - <span size="small">This program comes with ABSOLUTELY NO WARRANTY. -See the <a href="https://www.gnu.org/licenses/gpl-3.0.html">GNU General Public License, version 3 or later</a> for details.</span> - 1 - center - 1 - - - - - - - 0 - About - - - - - - diff --git a/ui/carousel4.ui b/ui/carousel4.ui index 4be8a98d..c3228742 100644 --- a/ui/carousel4.ui +++ b/ui/carousel4.ui @@ -56,7 +56,7 @@ Author: Michael Carroll 320 - 180 + 120 0 1 1 @@ -186,7 +186,7 @@ Author: Michael Carroll 120 0 preferences-desktop-wallpaper-symbolic - 3 + 2 0 0 diff --git a/ui/prefsadw.ui b/ui/prefsadw.ui new file mode 100644 index 00000000..538035c9 --- /dev/null +++ b/ui/prefsadw.ui @@ -0,0 +1,438 @@ + + + + + + + emblem-photos-symbolic + Settings + + + Indicator + + + Hide Indicator + Whether to hide the panel indicator + + + + + Desktop notifications + Enable notifications on new images + + + + + Indicator icon + Select from alternate tray icons + + + 1 + 5 + 1 + + + + + + + + + + 64 + 64 + 0 + end + 1 + ../icons/bing-symbolic.svg + icon_image_black_bg + + + + + + + + + Wallpaper + + + Set wallpaper + Whether to set wallpaper automatically + + + + + Shuffle wallpaper + Randomly select wallpaper from collection + + + + + Shuffle interval + How frequently to shuffle wallpapers + + + + + + + Downloads + + + Download folder + Open or change wallpaper downloads folder + + + + + + + applications-system-symbolic + Lock screen + + + Lockscreen blur + + + Dynamic lockscreen blur + Whether to enable dynamic blur mode on lock screen + + + + + Blur strength + Blur strength when login prompt is not visible + + + 0 + 50 + 10 + 1 + + + + + + + Wallpaper brightness + Dim wallpaper when login prompt is not visible + + + 0 + 100 + 10 + 1 + + + + + + + + + + + + Presets + + + + + + + document-open-recent-symbolic + Gallery + + + 0 + 500 + 0 + 0 + + + + + 0 + center + 1 + 2 + 2 + 2 + 2 + + + + + + + + + preferences-other-symbolic + Debug + + + Debug options + + + Debug logging + Enable logging to system journal + + + + + Always show new images + Switch to new images when available (unless on random mode) + + + + + Purge on trash + Trashing an image will remove it from database + + + + + Screen resolution + Override automatic resolution selection + + + + + Random interval + Custom shuffle interval when enabled + + + 300 + 604800 + 300 + 3600 + + + + + + + + + + + + Always export Bing data + Export Bing JSON when image data changes + + + + + Bing JSON data + Custom shuffle interval when enabled + + + + + + + user-info-symbolic + About + + + + + + 128 + presentation + + + + + + True + center + Bing Wallpaper + + + + + + 0 + New wallpaper images everyday from Bing + center + 1 + + + + + + True + center + Maintained by Michael Carroll + + + + + + + + + Version + + + center + True + + + + + + + + Release notes + + + True + left + + + + + + + + + + + vertical + + + + + + GNOME extensions page + True + True + extension_page_linkbutton + + + https://extensions.gnome.org/extension/1262/bing-wallpaper-changer/ + + + + + adw-external-link-symbolic + presentation + + + + + + + Source code + True + True + source_code_linkbutton + + + https://github.com/neffo/bing-wallpaper-gnome-extension + + + + + adw-external-link-symbolic + presentation + + + + + + + Report an issue + True + True + bug_report_linkbutton + + + https://github.com/neffo/bing-wallpaper-gnome-extension/issues + + + + + adw-external-link-symbolic + presentation + + + + + + + Contributors + True + True + contributors_linkbutton + + + https://github.com/neffo/bing-wallpaper-gnome-extension/graphs/contributors + + + + + adw-external-link-symbolic + presentation + + + + + + + License + + + True + left + This extension is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + + + + + + + + + + + + + Change folder + true + Select new wallpaper download folder + + + + \ No newline at end of file diff --git a/utils.js b/utils.js index 6f2ff22c..1ebe1592 100644 --- a/utils.js +++ b/utils.js @@ -12,9 +12,9 @@ import GLib from 'gi://GLib'; import Soup from 'gi://Soup'; import GdkPixbuf from 'gi://GdkPixbuf'; -export var PRESET_GNOME_DEFAULT = { blur: 60, dim: 55 }; // as at GNOME 40 -export var PRESET_NO_BLUR = { blur: 0, dim: 60 }; -export var PRESET_SLIGHT_BLUR = { blur: 2, dim: 60 }; +export var PRESET_GNOME_DEFAULT = { blur: 45, dim: 65 }; // as at GNOME 40 +export var PRESET_NO_BLUR = { blur: 0, dim: 65 }; +export var PRESET_SLIGHT_BLUR = { blur: 2, dim: 30 }; export var BING_SCHEMA = 'org.gnome.shell.extensions.bingwallpaper'; export var DESKTOP_SCHEMA = 'org.gnome.desktop.background'; @@ -52,7 +52,8 @@ export var backgroundStyle = ['none', 'wallpaper', 'centered', 'scaled', 'stretc export var randomIntervals = [ {value: 'hourly', title: ('on the hour')}, {value: 'daily', title: ('every day at midnight')}, - {value: 'weekly', title: ('every Sunday at midnight')} ]; + {value: 'weekly', title: ('Sunday at midnight')}, + { value: 'custom', title: ('User defined interval')} ]; export var BingImageURL = 'https://www.bing.com/HPImageArchive.aspx'; export var BingParams = { format: 'js', idx: '0' , n: '8' , mbl: '1' , mkt: '' } ; @@ -67,7 +68,7 @@ export function validate_icon(settings, extension_path, icon_image = null) { // if called from prefs if (icon_image) { BingLog('set icon to: ' + extension_path + '/icons/' + icon_name + '.svg'); - let pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(extension_path + '/icons/' + icon_name + '.svg', 32, 32); + let pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(extension_path + '/icons/' + icon_name + '.svg', 64, 64); icon_image.set_from_pixbuf(pixbuf); } } @@ -78,6 +79,12 @@ export function validate_resolution(settings) { settings.reset('resolution'); } +export function validate_interval(settings) { + let index = randomIntervals.map( e => e.value).indexOf(settings.get_string('random-interval-mode')); + if (index == -1) // if not a valid interval + settings.reset('random-interval-mode'); +} + // FIXME: needs work export function validate_imagename(settings) { let filename = settings.get_string('selected-image'); @@ -188,16 +195,15 @@ export function setImageList(settings, imageList) { } } -export function setImageHiddenStatus(settings, hide_image_list, hide_status) { +export function setImageHiddenStatus(settings, hide_image, hide_status) { // get current image list let image_list = getImageList(settings); + log ('image count = '+image_list.length+', hide_image = '+hide_image); image_list.forEach( (x, i) => { - hide_image_list.forEach(u => { - if (u.includes(x.urlbase)) { - // mark as hidden - x.hidden = hide_status; - } - }); + if (hide_image.includes(x.urlbase)) { + // mark as hidden + x.hidden = hide_status; + } }); // export image list back to settings setImageList(settings, image_list); @@ -294,6 +300,8 @@ export function getImageByIndex(imageList, index) { } export function cleanupImageList(settings) { + if (settings.get_boolean('trash-deletes-images') == false) + return; let curList = imageListSortByDate(getImageList(settings)); let cutOff = GLib.DateTime.new_now_utc().add_days(-8); // 8 days ago let newList = [];