[gnome] Update extensions for version 48
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
// Bing Wallpaper GNOME extension
|
||||
// Copyright (C) 2017-2023 Michael Carroll
|
||||
// Copyright (C) 2017-2025 Michael Carroll
|
||||
// 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
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ Also, check out my related [Google Earth View wallpaper extension](https://githu
|
||||
|
||||

|
||||
|
||||
The 4 buttons in the gallery (3rd page in the preferences) do have tool-tips but these do the following:
|
||||
The 5 buttons in the gallery (3rd page in the preferences) do have tool-tips but these do the following:
|
||||
- Favorite - favorite this image (equivalent to doing this via the control bar)
|
||||
- Apply - set this image as wallpaper
|
||||
- View - open image in image viewer
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// Bing Wallpaper GNOME extension
|
||||
// Copyright (C) 2017-2023 Michael Carroll
|
||||
// Copyright (C) 2017-2025 Michael Carroll
|
||||
// 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
|
||||
@ -32,7 +32,7 @@ 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);
|
||||
}
|
||||
@ -40,14 +40,14 @@ function log(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,
|
||||
@ -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
|
||||
@ -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) {
|
||||
@ -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;
|
||||
@ -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;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// Bing Wallpaper GNOME extension
|
||||
// Copyright (C) 2017-2023 Michael Carroll
|
||||
// Copyright (C) 2017-2025 Michael Carroll
|
||||
// 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
|
||||
@ -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);
|
||||
@ -43,11 +43,6 @@ export default class Carousel {
|
||||
}
|
||||
|
||||
_create_gallery() {
|
||||
Utils.randomIntervals.forEach((x) => {
|
||||
let item = this._create_random_item(x.value, _(x.title));
|
||||
this.flowBox.insert(item, -1);
|
||||
});
|
||||
|
||||
this.imageList.forEach((image) => {
|
||||
let item = this._create_gallery_item(image);
|
||||
this.flowBox.insert(item, -1);
|
||||
@ -72,7 +67,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);
|
||||
@ -84,7 +79,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);
|
||||
@ -96,16 +91,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
|
||||
@ -116,7 +111,7 @@ 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);
|
||||
@ -124,7 +119,7 @@ export default class Carousel {
|
||||
|
||||
// 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);
|
||||
@ -134,27 +129,6 @@ export default class Carousel {
|
||||
return item;
|
||||
}
|
||||
|
||||
_create_random_item(interval, title) {
|
||||
let buildable = new Gtk.Builder();
|
||||
|
||||
// grab appropriate object from UI file
|
||||
buildable.add_objects_from_file(this.extensionPath + '/ui/carousel4.ui', ["flowBoxRandom"]);
|
||||
|
||||
let randomLabel = buildable.get_object('randomLabel');
|
||||
randomLabel.set_text(title);
|
||||
let filename = 'random';
|
||||
let applyButton = buildable.get_object('randomButton');
|
||||
|
||||
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+')');
|
||||
});
|
||||
|
||||
let item = buildable.get_object('flowBoxRandom');
|
||||
return item;
|
||||
}
|
||||
|
||||
_create_placeholder_item() {
|
||||
let buildable = new Gtk.Builder();
|
||||
this.flowBox.set_max_children_per_line(1);
|
||||
@ -212,7 +186,7 @@ export default class Carousel {
|
||||
}
|
||||
catch (e) {
|
||||
this._set_blank_image(galleryImage);
|
||||
this.log('create_gallery_image: '+e);
|
||||
this._log('create_gallery_image: '+e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -222,8 +196,8 @@ 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
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// Bing Wallpaper GNOME extension
|
||||
// Copyright (C) 2017-2023 Michael Carroll
|
||||
// Copyright (C) 2017-2025 Michael Carroll
|
||||
// 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
|
||||
@ -54,7 +54,7 @@ const newMenuSwitchItem = (label, state) => {
|
||||
return switchItem;
|
||||
}
|
||||
|
||||
function log(msg) {
|
||||
function BingLog(msg) {
|
||||
if (BingDebug())
|
||||
console.log('BingWallpaper extension: ' + msg); // disable to keep the noise down in journal
|
||||
}
|
||||
@ -78,7 +78,7 @@ function doSetBackground(uri, schema) {
|
||||
gsettings.set_string('picture-uri-dark', uri);
|
||||
}
|
||||
catch (e) {
|
||||
log("unable to set dark background for : " + e);
|
||||
BingLog("unable to set dark background for : " + e);
|
||||
}
|
||||
Gio.Settings.sync();
|
||||
gsettings.apply();
|
||||
@ -296,12 +296,12 @@ class BingWallpaperIndicator extends Button {
|
||||
toggles.forEach( (e) => {
|
||||
this.settings_connections.push(
|
||||
this._settings.connect('changed::'+e.key, () => {
|
||||
log(e.key+' setting changed to '+ (this._settings.get_boolean(e.key)?'true':'false'));
|
||||
BingLog(e.key+' setting changed to '+ (this._settings.get_boolean(e.key)?'true':'false'));
|
||||
e.toggle.setToggleState(this._settings.get_boolean(e.key));
|
||||
})
|
||||
);
|
||||
e.toggle.connect('toggled', (item, state) => {
|
||||
log(e.key+' switch toggled to '+ (state?'true':'false'));
|
||||
BingLog(e.key+' switch toggled to '+ (state?'true':'false'));
|
||||
this._setBooleanSetting(e.key, state);
|
||||
});
|
||||
});
|
||||
@ -319,17 +319,17 @@ class BingWallpaperIndicator extends Button {
|
||||
|
||||
_setBooleanSetting(key, state) {
|
||||
let success = this._settings.set_boolean(key, state);
|
||||
log('key '+key+' set to ' + (state?'true':'false') + ' (returned ' + (success?'true':'false')+')');
|
||||
BingLog('key '+key+' set to ' + (state?'true':'false') + ' (returned ' + (success?'true':'false')+')');
|
||||
}
|
||||
|
||||
_setStringSetting(key, value) {
|
||||
let success = this._settings.set_string(key, value);
|
||||
log('key '+key+' set to ' + value + ' (returned ' + (success?'true':'false')+')');
|
||||
BingLog('key '+key+' set to ' + value + ' (returned ' + (success?'true':'false')+')');
|
||||
}
|
||||
|
||||
_setIntSetting(key, value) {
|
||||
let success = this._settings.set_int(key, value);
|
||||
log('key '+key+' set to ' + value + ' (returned ' + (success?'true':'false')+')');
|
||||
BingLog('key '+key+' set to ' + value + ' (returned ' + (success?'true':'false')+')');
|
||||
}
|
||||
|
||||
_onDestroy() {
|
||||
@ -358,14 +358,15 @@ class BingWallpaperIndicator extends Button {
|
||||
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" +
|
||||
" (" + (this.refreshdue?Utils.friendly_time_diff(this.refreshdue):"-") + ")\n" +
|
||||
_("Last refresh") + ": " + (maxlongdate? this._localeDate(maxlongdate, true) : '-');
|
||||
// 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.refreshdue?Utils.friendly_time_diff(this.shuffledue):"-") + ")";
|
||||
}
|
||||
BingLog('refreshduetext :'+this.refreshduetext);
|
||||
this.refreshDueItem.label.set_text(this.refreshduetext);
|
||||
}
|
||||
|
||||
@ -378,7 +379,7 @@ class BingWallpaperIndicator extends Button {
|
||||
_setImage() {
|
||||
Utils.validate_imagename(this._settings);
|
||||
this.selected_image = this._settings.get_string('selected-image');
|
||||
log('selected image changed to: ' + this.selected_image);
|
||||
BingLog('selected image changed to: ' + this.selected_image);
|
||||
this._selectImage();
|
||||
//this._setShuffleToggleState();
|
||||
}
|
||||
@ -398,7 +399,7 @@ class BingWallpaperIndicator extends Button {
|
||||
let icon_name = this._settings.get_string('icon-name');
|
||||
let gicon = Gio.icon_new_for_string(this._extension.dir.get_child('icons').get_path() + '/' + icon_name + '.svg');
|
||||
this.icon = new St.Icon({gicon: gicon, style_class: 'system-status-icon'});
|
||||
log('Replace icon set to: ' + icon_name);
|
||||
BingLog('Replace icon set to: ' + icon_name);
|
||||
this.remove_all_children();
|
||||
this.add_child(this.icon);
|
||||
}
|
||||
@ -411,7 +412,7 @@ class BingWallpaperIndicator extends Button {
|
||||
this._setThumbnailImage();
|
||||
if (!this.dimensions.width || !this.dimensions.height) // if dimensions aren't in image database yet
|
||||
[this.dimensions.width, this.dimensions.height] = Utils.getFileDimensions(this.filename);
|
||||
log('image set to : '+this.filename);
|
||||
BingLog('image set to : '+this.filename);
|
||||
if (this._settings.get_boolean('set-background'))
|
||||
this._setBackgroundDesktop();
|
||||
}
|
||||
@ -439,7 +440,7 @@ class BingWallpaperIndicator extends Button {
|
||||
difference = 60;
|
||||
difference = difference + 300; // 5 minute fudge offset in case of inaccurate local clock
|
||||
|
||||
log('Next refresh due ' + difference + ' seconds from now');
|
||||
BingLog('Next refresh due ' + difference + ' seconds from now');
|
||||
this._restartTimeout(difference);
|
||||
}
|
||||
|
||||
@ -450,7 +451,7 @@ class BingWallpaperIndicator extends Button {
|
||||
if (difference < 60 || difference > 86400) // clamp to a reasonable range
|
||||
difference = 60;
|
||||
|
||||
log('Next shuffle due ' + difference + ' seconds from now');
|
||||
BingLog('Next shuffle due ' + difference + ' seconds from now');
|
||||
this._restartShuffleTimeout(difference);
|
||||
}
|
||||
|
||||
@ -563,24 +564,26 @@ class BingWallpaperIndicator extends Button {
|
||||
return;
|
||||
}
|
||||
|
||||
const image = new Clutter.Image();
|
||||
const success = image.set_data(
|
||||
const [version] = Config.PACKAGE_VERSION.split('.').map(s => Number(s));
|
||||
const image = new St.ImageContent();
|
||||
const success = image.set_data.apply(image, [
|
||||
...version >= 48 ? [Clutter.get_default_backend().get_cogl_context()] : [],
|
||||
pixbuf.get_pixels(),
|
||||
pixbuf.get_has_alpha() ? Cogl.PixelFormat.RGBA_8888 : Cogl.PixelFormat.RGB_888,
|
||||
width,
|
||||
height,
|
||||
pixbuf.get_rowstride()
|
||||
);
|
||||
pixbuf.get_rowstride(),
|
||||
]);
|
||||
|
||||
if (!success) {
|
||||
throw Error("error creating Clutter.Image()");
|
||||
throw Error("error creating St.ImageContent()");
|
||||
}
|
||||
|
||||
this.thumbnailItem.hexpand = false;
|
||||
this.thumbnailItem.vexpand = false;
|
||||
this.thumbnailItem.content = image;
|
||||
|
||||
log('scale factor: ' + scale_factor);
|
||||
BingLog('scale factor: ' + scale_factor);
|
||||
this.thumbnailItem.set_size(480*scale_factor, 270*scale_factor);
|
||||
this.thumbnailItem.setSensitive(true);
|
||||
}
|
||||
@ -606,7 +609,7 @@ class BingWallpaperIndicator extends Button {
|
||||
x.setSensitive(randomEnabled);
|
||||
});
|
||||
if (randomEnabled) {
|
||||
log('enabled shuffle mode, by setting a shuffe timer (5 seconds)');
|
||||
BingLog('enabled shuffle mode, by setting a shuffe timer (5 seconds)');
|
||||
this._restartShuffleTimeout(5);
|
||||
this._setBooleanSetting('revert-to-current-image', false);
|
||||
}
|
||||
@ -619,19 +622,19 @@ class BingWallpaperIndicator extends Button {
|
||||
}
|
||||
|
||||
_favouriteImage() {
|
||||
log('favourite image '+this.imageURL+' status was '+this.favourite_status);
|
||||
BingLog('favourite image '+this.imageURL+' status was '+this.favourite_status);
|
||||
this.favourite_status = !this.favourite_status;
|
||||
Utils.setImageFavouriteStatus(this._settings, this.imageURL, this.favourite_status);
|
||||
this._setFavouriteIcon(this.favourite_status?this.ICON_FAVE_BUTTON:this.ICON_UNFAVE_BUTTON);
|
||||
}
|
||||
|
||||
_trashImage() {
|
||||
log('trash image '+this.imageURL+' status was '+this.hidden_status);
|
||||
BingLog('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?this.ICON_UNTRASH_BUTTON:this.ICON_TRASH_BUTTON);
|
||||
if (this._settings.get_boolean('trash-deletes-images')) {
|
||||
log('image to be deleted: '+this.filename);
|
||||
BingLog('image to be deleted: '+this.filename);
|
||||
Utils.deleteImage(this.filename);
|
||||
Utils.validate_imagename(this._settings);
|
||||
}
|
||||
@ -705,7 +708,7 @@ class BingWallpaperIndicator extends Button {
|
||||
});
|
||||
}
|
||||
catch(error) {
|
||||
log('unable to send libsoup json message '+error);
|
||||
BingLog('unable to send libsoup json message '+error);
|
||||
notifyError('Unable to fetch Bing metadata\n'+error);
|
||||
}
|
||||
}
|
||||
@ -721,7 +724,7 @@ class BingWallpaperIndicator extends Button {
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
log('unable to send libsoup json message '+error);
|
||||
BingLog('unable to send libsoup json message '+error);
|
||||
notifyError('Unable to fetch Bing metadata\n'+error);
|
||||
}
|
||||
}
|
||||
@ -734,14 +737,14 @@ class BingWallpaperIndicator extends Button {
|
||||
decoder.decode(this.httpSession.send_and_read_finish(message).get_data()): // Soup3
|
||||
message.response_body.data; // Soup 2
|
||||
|
||||
log('Recieved ' + data.length + ' bytes');
|
||||
BingLog('Recieved ' + data.length + ' bytes');
|
||||
this._parseData(data);
|
||||
|
||||
if (!this._settings.get_boolean('random-mode-enabled'))
|
||||
this._selectImage();
|
||||
}
|
||||
catch (error) {
|
||||
log('Network error occured: ' + error);
|
||||
BingLog('Network error occured: ' + error);
|
||||
notifyError('network error occured\n'+error);
|
||||
this._updatePending = false;
|
||||
this._restartTimeout(TIMEOUT_SECONDS_ON_HTTP_ERROR);
|
||||
@ -758,11 +761,11 @@ class BingWallpaperIndicator extends Button {
|
||||
|
||||
this._timeout = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, seconds, this._refresh.bind(this));
|
||||
this.refreshdue = GLib.DateTime.new_now_local().add_seconds(seconds);
|
||||
log('next check in ' + seconds + ' seconds');
|
||||
BingLog('next check in ' + seconds + ' seconds');
|
||||
}
|
||||
|
||||
_restartShuffleTimeout(seconds = null) {
|
||||
log('_restartShuffleTimeout('+seconds+')');
|
||||
BingLog('_restartShuffleTimeout('+seconds+')');
|
||||
//console.trace();
|
||||
|
||||
if (this._shuffleTimeout)
|
||||
@ -770,14 +773,14 @@ 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);
|
||||
BingLog('shuffle ('+this.shuffledue.format_iso8601()+') diff = '+diff);
|
||||
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') {
|
||||
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');
|
||||
BingLog('shuffle mode = '+random_mode+' = '+seconds+' from now');
|
||||
}
|
||||
else {
|
||||
seconds = this._settings.get_int('random-interval'); // or whatever the user has specified (as a timer)
|
||||
@ -786,7 +789,7 @@ class BingWallpaperIndicator extends Button {
|
||||
|
||||
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');
|
||||
BingLog('next shuffle in ' + seconds + ' seconds');
|
||||
}
|
||||
|
||||
// auto export Bing data to JSON file if requested
|
||||
@ -805,7 +808,7 @@ class BingWallpaperIndicator extends Button {
|
||||
let newImages = Utils.mergeImageLists(this._settings, parsed.images);
|
||||
|
||||
if (datamarket != prefmarket && prefmarket != 'auto')
|
||||
log('WARNING: Bing returning market data for ' + datamarket + ' rather than selected ' + prefmarket);
|
||||
BingLog('WARNING: Bing returning market data for ' + datamarket + ' rather than selected ' + prefmarket);
|
||||
|
||||
Utils.purgeImages(this._settings); // delete older images if enabled
|
||||
//Utils.cleanupImageList(this._settings); // merged into purgeImages
|
||||
@ -821,7 +824,7 @@ class BingWallpaperIndicator extends Button {
|
||||
if (!this._settings.get_boolean('notify-only-latest')) {
|
||||
// notify all new images
|
||||
newImages.forEach((image) => {
|
||||
log('New image to notify: ' + Utils.getImageTitle(image));
|
||||
BingLog('New image to notify: ' + Utils.getImageTitle(image));
|
||||
this._createImageNotification(image);
|
||||
});
|
||||
}
|
||||
@ -829,7 +832,7 @@ class BingWallpaperIndicator extends Button {
|
||||
// notify only the most recent image
|
||||
let last = newImages.pop();
|
||||
if (last) {
|
||||
log('New image to notify: ' + Utils.getImageTitle(last));
|
||||
BingLog('New image to notify: ' + Utils.getImageTitle(last));
|
||||
this._createImageNotification(last);
|
||||
}
|
||||
}
|
||||
@ -839,9 +842,9 @@ class BingWallpaperIndicator extends Button {
|
||||
this._updatePending = false;
|
||||
}
|
||||
catch (error) {
|
||||
log('_parseData() failed with error ' + error + ' @ '+error.lineNumber);
|
||||
BingLog('_parseData() failed with error ' + error + ' @ '+error.lineNumber);
|
||||
notifyError('Bing metadata parsing error check ' + error + ' @ '+error.lineNumber);
|
||||
log(error.stack);
|
||||
BingLog(error.stack);
|
||||
}
|
||||
}
|
||||
|
||||
@ -855,7 +858,7 @@ class BingWallpaperIndicator extends Button {
|
||||
let msg = _('Bing Wallpaper of the Day for') + ' ' + this._localeDate(image.fullstartdate);
|
||||
let details = Utils.getImageTitle(image);
|
||||
this._createNotification(msg, details);
|
||||
log('_createImageNotification: '+msg+' details: '+details);
|
||||
BingLog('_createImageNotification: '+msg+' details: '+details);
|
||||
}
|
||||
|
||||
_createNotification(msg, details) {
|
||||
@ -869,7 +872,7 @@ class BingWallpaperIndicator extends Button {
|
||||
});
|
||||
systemSource.addNotification(bingNotify);
|
||||
//Main.notify(msg, details);
|
||||
log('_createNotification: '+msg+' details: '+details);
|
||||
BingLog('_createNotification: '+msg+' details: '+details);
|
||||
}
|
||||
|
||||
_shuffleImage() {
|
||||
@ -885,7 +888,7 @@ class BingWallpaperIndicator extends Button {
|
||||
imageList = favImageList;
|
||||
}
|
||||
else {
|
||||
log('not enough filtered images available to shuffle');
|
||||
BingLog('not enough filtered images available to shuffle');
|
||||
}
|
||||
|
||||
// shuffle could fail for a number of reasons
|
||||
@ -893,12 +896,12 @@ class BingWallpaperIndicator extends Button {
|
||||
this.imageIndex = Utils.getRandomInt(imageList.length);
|
||||
image = imageList[this.imageIndex];
|
||||
|
||||
log('shuffled to image '+image.urlbase);
|
||||
BingLog('shuffled to image '+image.urlbase);
|
||||
|
||||
return image;
|
||||
}
|
||||
catch (e) {
|
||||
log('shuffle failed '+e);
|
||||
BingLog('shuffle failed '+e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -909,7 +912,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')
|
||||
BingLog('forcing shuffle of image')
|
||||
image = this._shuffleImage();
|
||||
if (this._settings.get_boolean('random-mode-enabled'))
|
||||
this._restartShuffleTimeout();
|
||||
@ -927,7 +930,7 @@ class BingWallpaperIndicator extends Button {
|
||||
|
||||
if (image)
|
||||
this.imageIndex = Utils.imageIndex(imageList, image.urlbase);
|
||||
log('_selectImage: ' + this.selected_image + ' = ' + (image && image.urlbase) ? image.urlbase : 'not found');
|
||||
BingLog('_selectImage: ' + this.selected_image + ' = ' + (image && image.urlbase ? image.urlbase : 'not found'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1003,7 +1006,7 @@ class BingWallpaperIndicator extends Button {
|
||||
};
|
||||
let stateJSON = JSON.stringify(state);
|
||||
|
||||
log('Storing state as JSON: ' + stateJSON);
|
||||
BingLog('Storing state as JSON: ' + stateJSON);
|
||||
this._setStringSetting('state', stateJSON);
|
||||
}
|
||||
}
|
||||
@ -1016,7 +1019,7 @@ class BingWallpaperIndicator extends Button {
|
||||
let state = JSON.parse(stateJSON);
|
||||
let maxLongDate = null;
|
||||
|
||||
log('restoring state...');
|
||||
BingLog('restoring state...');
|
||||
maxLongDate = state.maxlongdate ? state.maxlongdate : null;
|
||||
this.title = state.title;
|
||||
this.explanation = state.explanation;
|
||||
@ -1040,7 +1043,7 @@ class BingWallpaperIndicator extends Button {
|
||||
}
|
||||
|
||||
if (this._settings.get_boolean('random-mode-enabled')) {
|
||||
log('random mode enabled, restarting random state');
|
||||
BingLog('random mode enabled, restarting random state');
|
||||
this._restartShuffleTimeoutFromDueDate(this.shuffledue); // FIXME: use state value
|
||||
this._restartTimeoutFromLongDate(maxLongDate);
|
||||
}
|
||||
@ -1051,7 +1054,7 @@ class BingWallpaperIndicator extends Button {
|
||||
return;
|
||||
}
|
||||
catch (error) {
|
||||
log('bad state - refreshing... error was ' + error);
|
||||
BingLog('bad state - refreshing... error was ' + error);
|
||||
}
|
||||
this._restartTimeout(60);
|
||||
}
|
||||
@ -1079,7 +1082,7 @@ class BingWallpaperIndicator extends Button {
|
||||
notifyError('Download folder '+BingWallpaperDir+' does not exist or is not writable');
|
||||
return;
|
||||
}
|
||||
log("Downloading " + url + " to " + file.get_uri());
|
||||
BingLog("Downloading " + url + " to " + file.get_uri());
|
||||
let request = Soup.Message.new('GET', url);
|
||||
|
||||
// queue the http request
|
||||
@ -1096,7 +1099,7 @@ class BingWallpaperIndicator extends Button {
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
log('error sending libsoup message '+error);
|
||||
BingLog('error sending libsoup message '+error);
|
||||
notifyError('Network error '+error);
|
||||
}
|
||||
}
|
||||
@ -1118,17 +1121,17 @@ class BingWallpaperIndicator extends Button {
|
||||
file.replace_contents_finish(res);
|
||||
if (set_background)
|
||||
this._setBackground();
|
||||
log('Download successful');
|
||||
BingLog('Download successful');
|
||||
}
|
||||
catch(e) {
|
||||
log('Error writing file: ' + e);
|
||||
BingLog('Error writing file: ' + e);
|
||||
notifyError('Image '+file.get_path()+' is not writable, check folder permissions or select a different folder\n'+e);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
catch (error) {
|
||||
log('Unable download image '+error);
|
||||
BingLog('Unable download image '+error);
|
||||
notifyError('Image '+file.get_path()+' file error, check folder permissions, disk space or select a different folder\n'+e);
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -7,9 +7,10 @@
|
||||
"shell-version": [
|
||||
"45",
|
||||
"46",
|
||||
"47"
|
||||
"47",
|
||||
"48"
|
||||
],
|
||||
"url": "https://github.com/neffo/bing-wallpaper-gnome-extension",
|
||||
"uuid": "BingWallpaper@ineffable-gmail.com",
|
||||
"version": 50
|
||||
"version": 51
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
// Bing Wallpaper GNOME extension
|
||||
// Copyright (C) 2017-2023 Michael Carroll
|
||||
// Copyright (C) 2017-2025 Michael Carroll
|
||||
// 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
|
||||
@ -44,7 +44,7 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen
|
||||
let carousel = null;
|
||||
let httpSession = null;
|
||||
|
||||
let log = (msg) => { // avoids need for globals
|
||||
let BingLog = (msg) => { // avoids need for globals
|
||||
if (settings.get_boolean('debug-logging'))
|
||||
console.log("BingWallpaper extension: " + msg); // disable to keep the noise down in journal
|
||||
}
|
||||
@ -82,7 +82,7 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen
|
||||
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 version_row = buildable.get_object('version_row');
|
||||
const change_log = buildable.get_object('change_log');
|
||||
|
||||
window.add(settings_page);
|
||||
@ -104,18 +104,12 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen
|
||||
|
||||
// add wallpaper folder open and change buttons
|
||||
const openBtn = new Gtk.Button( {
|
||||
child: new Adw.ButtonContent({
|
||||
icon_name: 'folder-pictures-symbolic',
|
||||
label: _('Open folder'),
|
||||
},),
|
||||
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'),
|
||||
},),
|
||||
label: _('Change folder'),
|
||||
valign: Gtk.Align.CENTER,
|
||||
halign: Gtk.Align.CENTER,
|
||||
});
|
||||
@ -127,26 +121,17 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen
|
||||
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'),
|
||||
},),
|
||||
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'),
|
||||
},),
|
||||
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'),
|
||||
},),
|
||||
label: _('Slight blur & dim'),
|
||||
valign: Gtk.Align.CENTER,
|
||||
halign: Gtk.Align.CENTER,
|
||||
});
|
||||
@ -160,18 +145,12 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen
|
||||
|
||||
// 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'),
|
||||
},),
|
||||
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'),
|
||||
},),
|
||||
label: _('Export'),
|
||||
valign: Gtk.Align.CENTER,
|
||||
halign: Gtk.Align.CENTER,
|
||||
});
|
||||
@ -179,27 +158,28 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen
|
||||
json_actionrow.add_suffix(buttonImportData);
|
||||
json_actionrow.add_suffix(buttonExportData);
|
||||
|
||||
version_button.set_label(this.metadata.version.toString());
|
||||
version_row.set_subtitle(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;
|
||||
}
|
||||
catch (e) {
|
||||
log("Error creating httpSession: " + e);
|
||||
BingLog("Error creating httpSession: " + e);
|
||||
}
|
||||
const icon_image = buildable.get_object('icon_image');
|
||||
const app_icon_image = buildable.get_object('app_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_icon(settings, this.path, icon_image, app_icon_image);
|
||||
Utils.validate_interval(settings);
|
||||
|
||||
// Indicator & notifications
|
||||
settings.bind('hide', hideSwitch, 'active', Gio.SettingsBindFlags.DEFAULT);
|
||||
settings.bind('notify', notifySwitch, 'active', Gio.SettingsBindFlags.DEFAULT);
|
||||
settings.connect('changed::icon-name', () => {
|
||||
Utils.validate_icon(settings, this.path, icon_image);
|
||||
Utils.validate_icon(settings, this.path, icon_image, app_icon_image);
|
||||
iconEntry.set_value(1 + Utils.icon_list.indexOf(settings.get_string('icon-name')));
|
||||
});
|
||||
|
||||
@ -245,7 +225,7 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen
|
||||
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);
|
||||
BingLog(new_path);
|
||||
Utils.moveImagesToNewFolder(settings, Utils.getWallpaperDir(settings), new_path);
|
||||
Utils.setWallpaperDir(settings, new_path);
|
||||
});
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// Bing Wallpaper GNOME extension
|
||||
// Copyright (C) 2017-2023 Michael Carroll
|
||||
// Copyright (C) 2017-2025 Michael Carroll
|
||||
// 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
|
||||
@ -23,7 +23,7 @@ export default class Thumbnail {
|
||||
this.pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(filePath, w, h);
|
||||
this.srcFile = Gio.File.new_for_path(filePath);
|
||||
} catch (err) {
|
||||
log('Unable to create thumbnail for corrupt or incomplete file: ' + filePath + ' err: ' + err);
|
||||
console.log('Unable to create thumbnail for corrupt or incomplete file: ' + filePath + ' err: ' + err);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -68,6 +68,9 @@ Author: Michael Carroll
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="vexpand">1</property>
|
||||
<property name="valign">center</property>
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkButton" id="favButton">
|
||||
<property name="tooltip-text" translatable="yes">Favorite</property>
|
||||
|
||||
@ -23,7 +23,7 @@ Bing Wallpaper GNOME extension by: Michael Carroll
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<requires lib="libadwaita" version="1.0"/>
|
||||
<object class="AdwPreferencesPage" id="settings_page">
|
||||
<property name="icon-name">emblem-photos-symbolic</property>
|
||||
<property name="icon-name">applications-system-symbolic</property>
|
||||
<property name="title" translatable="yes">Settings</property>
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup" id="ui_group">
|
||||
@ -110,7 +110,7 @@ Bing Wallpaper GNOME extension by: Michael Carroll
|
||||
</child>
|
||||
</object>
|
||||
<object class="AdwPreferencesPage" id="lockscreen_page">
|
||||
<property name="icon-name">applications-system-symbolic</property>
|
||||
<property name="icon-name">system-lock-screen-symbolic</property>
|
||||
<property name="title" translatable="yes">Lock screen</property>
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup" id="ls_group">
|
||||
@ -163,7 +163,7 @@ Bing Wallpaper GNOME extension by: Michael Carroll
|
||||
</child>
|
||||
</object>
|
||||
<object class="AdwPreferencesPage" id="gallery_page">
|
||||
<property name="icon-name">document-open-recent-symbolic</property>
|
||||
<property name="icon-name">emblem-photos-symbolic</property>
|
||||
<property name="title" translatable="yes">Gallery</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="carouselViewPort">
|
||||
@ -286,7 +286,8 @@ Bing Wallpaper GNOME extension by: Michael Carroll
|
||||
<!-- <property name="orientation">vertical</property>-->
|
||||
<child>
|
||||
<object class="GtkImage" id="app_icon_image">
|
||||
<property name="pixel-size">128</property>
|
||||
<property name="pixel-size">64</property>
|
||||
<property name="margin-bottom">8</property>
|
||||
<property name="accessible-role">presentation</property>
|
||||
<style>
|
||||
<class name="icon-dropshadow"/>
|
||||
@ -324,17 +325,11 @@ Bing Wallpaper GNOME extension by: Michael Carroll
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup" id="change_log_group">
|
||||
<child>
|
||||
<object class="AdwActionRow" id="details_row">
|
||||
<object class="AdwActionRow" id="version_row">
|
||||
<property name="title" translatable="yes">Version</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="version_button">
|
||||
<property name="halign">center</property>
|
||||
<property name="can-shrink">True</property>
|
||||
<style>
|
||||
<class name="app-version"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="property"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -367,6 +362,8 @@ Bing Wallpaper GNOME extension by: Michael Carroll
|
||||
<child>
|
||||
<object class="GtkLinkButton" id="extension_page_linkbutton">
|
||||
<property name="uri">https://extensions.gnome.org/extension/1262/bing-wallpaper-changer/</property>
|
||||
<property name="label">GNOME Extensions</property>
|
||||
<property name="valign">GTK_ALIGN_CENTER</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -386,6 +383,8 @@ Bing Wallpaper GNOME extension by: Michael Carroll
|
||||
<child>
|
||||
<object class="GtkLinkButton" id="source_code_linkbutton">
|
||||
<property name="uri">https://github.com/neffo/bing-wallpaper-gnome-extension</property>
|
||||
<property name="label">GitHub</property>
|
||||
<property name="valign">GTK_ALIGN_CENTER</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -405,6 +404,8 @@ Bing Wallpaper GNOME extension by: Michael Carroll
|
||||
<child>
|
||||
<object class="GtkLinkButton" id="bug_report_linkbutton">
|
||||
<property name="uri">https://github.com/neffo/bing-wallpaper-gnome-extension/issues</property>
|
||||
<property name="label">GitHub</property>
|
||||
<property name="valign">GTK_ALIGN_CENTER</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -424,6 +425,8 @@ Bing Wallpaper GNOME extension by: Michael Carroll
|
||||
<child>
|
||||
<object class="GtkLinkButton" id="contributors_linkbutton">
|
||||
<property name="uri">https://github.com/neffo/bing-wallpaper-gnome-extension/graphs/contributors</property>
|
||||
<property name="label">GitHub</property>
|
||||
<property name="valign">GTK_ALIGN_CENTER</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// Bing Wallpaper GNOME extension
|
||||
// Copyright (C) 2017-2023 Michael Carroll
|
||||
// Copyright (C) 2017-2025 Michael Carroll
|
||||
// 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
|
||||
@ -58,7 +58,12 @@ export var randomIntervals = [ {value: 'hourly', title: ('on the hour')},
|
||||
export var BingImageURL = 'https://www.bing.com/HPImageArchive.aspx';
|
||||
export var BingParams = { format: 'js', idx: '0' , n: '8' , mbl: '1' , mkt: '' } ;
|
||||
|
||||
export function validate_icon(settings, extension_path, icon_image = null) {
|
||||
export function validate_icon(
|
||||
settings,
|
||||
extension_path,
|
||||
icon_image = null,
|
||||
app_icon_image = null
|
||||
) {
|
||||
BingLog('validate_icon()');
|
||||
let icon_name = settings.get_string('icon-name');
|
||||
if (icon_name == '' || icon_list.indexOf(icon_name) == -1) {
|
||||
@ -66,10 +71,11 @@ export function validate_icon(settings, extension_path, icon_image = null) {
|
||||
icon_name = settings.get_string('icon-name');
|
||||
}
|
||||
// if called from prefs
|
||||
if (icon_image) {
|
||||
if (icon_image && app_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', 64, 64);
|
||||
icon_image.set_from_pixbuf(pixbuf);
|
||||
app_icon_image.set_from_pixbuf(pixbuf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user