Skip to content

Commit

Permalink
clarify which log function we are using
Browse files Browse the repository at this point in the history
  • Loading branch information
neffo committed Sep 29, 2024
1 parent 074cda6 commit 4eb5828
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 73 deletions.
4 changes: 2 additions & 2 deletions BWClipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ export default class BWClipboard {
try {
let file = Gio.File.new_for_path(filename);
let [success, image_data] = file.load_contents(null);
//log('error: '+success);
//console.log('error: '+success);
if (success)
this.clipboard.set_content(CLIPBOARD_TYPE, 'image/jpeg', image_data);
} catch (err) {
log('unable to set clipboard to data in '+filename);
console.log('unable to set clipboard to data in '+filename);
}
}

Expand Down
18 changes: 9 additions & 9 deletions blur.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@ var debug = false;
var promptActive = false; // default GNOME method of testing this relies on state of a transisiton
// so we are being explicit here (do not want any races, thanks)

function log(msg) {
function BingLog(msg) {
if (debug) // set 'debug' above to false to keep the noise down in journal
console.log("BingWallpaper extension/Blur: " + msg);
}

// we patch UnlockDialog._updateBackgroundEffects()
export function _updateBackgroundEffects_BWP(monitorIndex) {
// GNOME shell 3.36.4 and above
log("_updateBackgroundEffects_BWP() called for shell >= 3.36.4");
BingLog("_updateBackgroundEffects_BWP() called for shell >= 3.36.4");
const themeContext = St.ThemeContext.get_for_stage(global.stage);
for (const widget of this._backgroundGroup.get_children()) {
// set blur effects, we have two modes in lockscreen: login prompt or clock
// blur on when clock is visible is adjustable
const effect = widget.get_effect('blur');
if (promptActive) {
log('default blur active');
BingLog('default blur active');
if (effect) {
effect.set({ // GNOME defaults when login prompt is visible
brightness: BLUR_BRIGHTNESS,
Expand All @@ -56,7 +56,7 @@ export function _updateBackgroundEffects_BWP(monitorIndex) {
}
}
else {
log('adjustable blur active');
BingLog('adjustable blur active');
if (effect) {
effect.set({ // adjustable blur when clock is visible
brightness: BWP_BLUR_BRIGHTNESS * 0.01, // we use 0-100 rather than 0-1, so divide by 100
Expand Down Expand Up @@ -92,17 +92,17 @@ export function _clampValue(value) {
export default class Blur {
constructor() {
this.enabled = false;
log('Bing Wallpaper adjustable blur is '+(supportedVersion()?'available':'not available'));
BingLog('Bing Wallpaper adjustable blur is '+(supportedVersion()?'available':'not available'));
}

set_blur_strength(value) {
BWP_BLUR_SIGMA = _clampValue(value);
log("lockscreen blur strength set to "+BWP_BLUR_SIGMA);
BingLog("lockscreen blur strength set to "+BWP_BLUR_SIGMA);
}

set_blur_brightness(value) {
BWP_BLUR_BRIGHTNESS = _clampValue(value);
log("lockscreen brightness set to " + BWP_BLUR_BRIGHTNESS);
BingLog("lockscreen brightness set to " + BWP_BLUR_BRIGHTNESS);
}

_switch(enabled) {
Expand All @@ -116,7 +116,7 @@ export default class Blur {

_enable() {
if (supportedVersion()) {
log("Blur._enable() called on GNOME "+Config.PACKAGE_VERSION);
BingLog("Blur._enable() called on GNOME "+Config.PACKAGE_VERSION);
UnlockDialog.UnlockDialog.prototype._updateBackgroundEffects = _updateBackgroundEffects_BWP;
// we override _showClock and _showPrompt to patch in updates to blur effect before calling the GNOME functions
UnlockDialog.UnlockDialog.prototype._showClock = _showClock_BWP;
Expand All @@ -133,7 +133,7 @@ export default class Blur {
_disable() {
if (!this.enabled)
return;
log("_lockscreen_blur_disable() called");
BingLog("_lockscreen_blur_disable() called");
if (supportedVersion()) {
// restore default functions
UnlockDialog.UnlockDialog.prototype._updateBackgroundEffects = _updateBackgroundEffects;
Expand Down
22 changes: 11 additions & 11 deletions carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default class Carousel {
this.searchEntry = null;
this.extensionPath = extensionPath

this.log('create carousel...');
this._log('create carousel...');

this.flowBox = prefs_flowbox;
this.flowBox.insert(this._create_placeholder_item(), -1);
Expand Down Expand Up @@ -72,7 +72,7 @@ export default class Carousel {

if (Utils.isFavourite(image)) {
favButton.set_visible(false);
this.log('image is favourited');
this._log('image is favourited');
}
else {
unfavButton.set_visible(false);
Expand All @@ -84,7 +84,7 @@ export default class Carousel {
catch (e) {
galleryImage.set_from_icon_name('image-missing');
galleryImage.set_icon_size = 2; // Gtk.GTK_ICON_SIZE_LARGE;
this.log('create_gallery_image: '+e);
this._log('create_gallery_image: '+e);
}

galleryImage.set_tooltip_text(image.copyright);
Expand All @@ -96,16 +96,16 @@ export default class Carousel {

applyButton.connect('clicked', () => {
this.settings.set_string('selected-image', Utils.getImageUrlBase(image));
this.log('gallery selected '+Utils.getImageUrlBase(image));
this._log('gallery selected '+Utils.getImageUrlBase(image));
});

infoButton.connect('clicked', () => {
Utils.openInSystemViewer(image.copyrightlink, false);
this.log('info page link opened '+image.copyrightlink);
this._log('info page link opened '+image.copyrightlink);
});

deleteButton.connect('clicked', (widget) => {
this.log('Delete requested for '+filename);
this._log('Delete requested for '+filename);
Utils.deleteImage(filename);
Utils.setImageHiddenStatus(this.settings, image.urlbase, true);
Utils.purgeImages(this.settings); // hide image instead
Expand All @@ -116,15 +116,15 @@ export default class Carousel {

// button is unchecked, so we want to make the checked one visible
favButton.connect('clicked', (widget) => {
this.log('favourited '+Utils.getImageUrlBase(image));
this._log('favourited '+Utils.getImageUrlBase(image));
widget.set_visible(false);
unfavButton.set_visible(true);
Utils.setImageFavouriteStatus(this.settings, image.urlbase, true);
});

// button is checked, so we want to make the unchecked one visible
unfavButton.connect('clicked', (widget) => {
this.log('unfavourited '+Utils.getImageUrlBase(image));
this._log('unfavourited '+Utils.getImageUrlBase(image));
widget.set_visible(false);
favButton.set_visible(true);
Utils.setImageFavouriteStatus(this.settings, image.urlbase, false);
Expand All @@ -148,7 +148,7 @@ export default class Carousel {
applyButton.connect('clicked', (widget) => {
this.settings.set_string('random-interval-mode', interval);
this.settings.set_boolean('random-mode-enabled', true);
this.log('gallery selected random with interval '+interval+' ('+title+')');
this._log('gallery selected random with interval '+interval+' ('+title+')');
});

let item = buildable.get_object('flowBoxRandom');
Expand Down Expand Up @@ -212,7 +212,7 @@ export default class Carousel {
}
catch (e) {
this._set_blank_image(galleryImage);
this.log('create_gallery_image: '+e);
this._log('create_gallery_image: '+e);
}
}
}
Expand All @@ -222,7 +222,7 @@ export default class Carousel {
//galleryImage.set_icon_size = 2; // Gtk.GTK_ICON_SIZE_LARGE;
}

log(msg) {
_log(msg) {
if (this.settings.get_boolean('debug-logging'))
console.log("BingWallpaper extension: " + msg); // disable to keep the noise down in journal
}
Expand Down
Loading

0 comments on commit 4eb5828

Please sign in to comment.