Skip to content

Commit

Permalink
Merge pull request #228 from neffo/version-49
Browse files Browse the repository at this point in the history
Version 49
  • Loading branch information
neffo authored Mar 20, 2024
2 parents bc29810 + c4df798 commit da7bffd
Show file tree
Hide file tree
Showing 16 changed files with 1,132 additions and 1,874 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ Settings.ui.h
Settings4.ui.h
carousel.ui.h
carousel4.ui.h
prefsadw.ui.h
test.js
27 changes: 13 additions & 14 deletions blur.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -68,43 +68,42 @@ 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;
log('Bing Wallpaper adjustable blur is '+supportedVersion()?'available':'not available');
}

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();
Expand Down
4 changes: 2 additions & 2 deletions buildzip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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');
Expand Down
14 changes: 11 additions & 3 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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') {
Expand Down Expand Up @@ -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();
Expand Down
Loading

0 comments on commit da7bffd

Please sign in to comment.