[gnome] Update extensions for v46
This commit is contained in:
@ -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();
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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();
|
||||
|
||||
Binary file not shown.
@ -5,9 +5,10 @@
|
||||
"name": "Bing Wallpaper",
|
||||
"settings-schema": "org.gnome.shell.extensions.bingwallpaper",
|
||||
"shell-version": [
|
||||
"45"
|
||||
"45",
|
||||
"46"
|
||||
],
|
||||
"url": "https://github.com/neffo/bing-wallpaper-gnome-extension",
|
||||
"uuid": "BingWallpaper@ineffable-gmail.com",
|
||||
"version": 48
|
||||
"version": 49
|
||||
}
|
||||
@ -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' );
|
||||
|
||||
let box = buildable.get_object('prefs_widget');
|
||||
// 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');
|
||||
|
||||
// fix size of prefs window in GNOME shell 40+ (but super racy, so is unreliable)
|
||||
window.add(settings_page);
|
||||
window.add(lockscreen_page);
|
||||
window.add(gallery_page);
|
||||
window.add(debug_page);
|
||||
window.add(about_page);
|
||||
|
||||
buildable.get_object('extension_version').set_text(this.metadata.version.toString());
|
||||
buildable.get_object('extension_name').set_text(this.metadata.name.toString());
|
||||
iconEntry.set_value(1+Utils.icon_list.indexOf(settings.get_string('icon-name')));
|
||||
|
||||
// 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;
|
||||
// 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,
|
||||
});
|
||||
|
||||
// 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();
|
||||
// change wallpaper button
|
||||
const dirChooser = new Gtk.FileDialog( {
|
||||
accept_label: "Select",
|
||||
modal: true,
|
||||
title: _("Select wallpaper download folder"),
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
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);
|
||||
});
|
||||
|
||||
// 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')));
|
||||
});
|
||||
|
||||
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);
|
||||
settings.connect('changed::random-interval-mode', () => {
|
||||
shuffleInterval.set_selected(Utils.randomIntervals.map( e => e.value).indexOf(settings.get_string('random-interval-mode')));
|
||||
});
|
||||
|
||||
// background styles (e.g. zoom or span)
|
||||
Utils.backgroundStyle.forEach((style) => {
|
||||
styleEntry.append(style, style);
|
||||
});
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@ -211,7 +211,7 @@
|
||||
</key>
|
||||
|
||||
<key name="trash-deletes-images" type="b">
|
||||
<default>false</default>
|
||||
<default>true</default>
|
||||
<summary>Trash deletes images or just marks as bad</summary>
|
||||
</key>
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -56,7 +56,7 @@ Author: Michael Carroll
|
||||
<child>
|
||||
<object class="GtkPicture" id="galleryImage">
|
||||
<property name="width-request">320</property>
|
||||
<property name="height-request">180</property>
|
||||
<property name="height-request">120</property>
|
||||
<property name="can-focus">0</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
@ -186,7 +186,7 @@ Author: Michael Carroll
|
||||
<property name="height-request">120</property>
|
||||
<property name="can-focus">0</property>
|
||||
<property name="icon-name">preferences-desktop-wallpaper-symbolic</property>
|
||||
<property name="icon_size">3</property>
|
||||
<property name="icon_size">2</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
|
||||
@ -0,0 +1,438 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2017-2024
|
||||
|
||||
This file is part of Bing Wallpaper extension preferences.
|
||||
|
||||
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.
|
||||
|
||||
This extension is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this extension. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Bing Wallpaper GNOME extension by: Michael Carroll
|
||||
-->
|
||||
<interface domain="BingWallpaper">
|
||||
<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="title" translatable="yes">Settings</property>
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup" id="ui_group">
|
||||
<property name="title" translatable="yes">Indicator</property>
|
||||
<child>
|
||||
<object class="AdwSwitchRow" id="hideSwitch">
|
||||
<property name="title" translatable="yes">Hide Indicator</property>
|
||||
<property name="subtitle" translatable="yes">Whether to hide the panel indicator</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwSwitchRow" id="notifySwitch">
|
||||
<property name="title" translatable="yes">Desktop notifications</property>
|
||||
<property name="subtitle" translatable="yes">Enable notifications on new images</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwSpinRow" id="iconEntry">
|
||||
<property name="title" translatable="yes">Indicator icon</property>
|
||||
<property name="subtitle" translatable="yes">Select from alternate tray icons</property>
|
||||
<property name="adjustment">
|
||||
<object class="GtkAdjustment" id="iconEntryAdjustment">
|
||||
<property name="lower">1</property>
|
||||
<property name="upper">5</property>
|
||||
<property name="step_increment">1</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwActionRow" id="icon_image_row">
|
||||
<!--
|
||||
<property name="title" translatable="yes">Download folder</property>
|
||||
<property name="subtitle" translatable="yes">Open or change wallpaper downloads folder</property>
|
||||
-->
|
||||
<child>
|
||||
<object class="GtkImage" id="icon_image">
|
||||
<property name="width_request">64</property>
|
||||
<property name="height_request">64</property>
|
||||
<property name="can_focus">0</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="file">../icons/bing-symbolic.svg</property>
|
||||
<property name="css_classes">icon_image_black_bg</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup" id="wp_group">
|
||||
<property name="title" translatable="yes">Wallpaper</property>
|
||||
<child>
|
||||
<object class="AdwSwitchRow" id="bgSwitch">
|
||||
<property name="title" translatable="yes">Set wallpaper</property>
|
||||
<property name="subtitle" translatable="yes">Whether to set wallpaper automatically</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwSwitchRow" id="shuffleSwitch">
|
||||
<property name="title" translatable="yes">Shuffle wallpaper</property>
|
||||
<property name="subtitle" translatable="yes">Randomly select wallpaper from collection</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwComboRow" id="shuffleInterval">
|
||||
<property name="title" translatable="yes">Shuffle interval</property>
|
||||
<property name="subtitle" translatable="yes">How frequently to shuffle wallpapers</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup" id="dl_group">
|
||||
<property name="title" translatable="yes">Downloads</property>
|
||||
<child>
|
||||
<object class="AdwActionRow" id="folderRow">
|
||||
<property name="title" translatable="yes">Download folder</property>
|
||||
<property name="subtitle" translatable="yes">Open or change wallpaper downloads folder</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="AdwPreferencesPage" id="lockscreen_page">
|
||||
<property name="icon-name">applications-system-symbolic</property>
|
||||
<property name="title" translatable="yes">Lock screen</property>
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup" id="ls_group">
|
||||
<property name="title" translatable="yes">Lockscreen blur</property>
|
||||
<child>
|
||||
<object class="AdwSwitchRow" id="overrideSwitch">
|
||||
<property name="title" translatable="yes">Dynamic lockscreen blur</property>
|
||||
<property name="subtitle" translatable="yes">Whether to enable dynamic blur mode on lock screen</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwSpinRow" id="strengthEntry">
|
||||
<property name="title" translatable="yes">Blur strength</property>
|
||||
<property name="subtitle" translatable="yes">Blur strength when login prompt is not visible</property>
|
||||
<property name="adjustment">
|
||||
<object class="GtkAdjustment" id="blurAdjustment">
|
||||
<property name="lower">0</property>
|
||||
<property name="upper">50</property>
|
||||
<property name="page_increment">10</property>
|
||||
<property name="step_increment">1</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwSpinRow" id="brightnessEntry">
|
||||
<property name="title" translatable="yes">Wallpaper brightness</property>
|
||||
<property name="subtitle" translatable="yes">Dim wallpaper when login prompt is not visible</property>
|
||||
<property name="adjustment">
|
||||
<object class="GtkAdjustment" id="brightnessAdjustment">
|
||||
<property name="lower">0</property>
|
||||
<property name="upper">100</property>
|
||||
<property name="page_increment">10</property>
|
||||
<property name="step_increment">1</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup" id="ps_group">
|
||||
<!-- <property name="title" translatable="yes">Presets</property> -->
|
||||
<child>
|
||||
<object class="AdwActionRow" id="blurPresets">
|
||||
<property name="title" translatable="yes">Presets</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="AdwPreferencesPage" id="gallery_page">
|
||||
<property name="icon-name">document-open-recent-symbolic</property>
|
||||
<property name="title" translatable="yes">Gallery</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="carouselViewPort">
|
||||
<property name="can-focus">0</property>
|
||||
<property name="height_request">500</property>
|
||||
<property name="hexpand">0</property>
|
||||
<property name="vexpand">0</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkFlowBox" id="carouselFlowBox">
|
||||
<property name="can-focus">0</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="max-children-per-line">2</property>
|
||||
<property name="min-children-per-line">2</property>
|
||||
<property name="row-spacing">2</property>
|
||||
<property name="column-spacing">2</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="AdwPreferencesPage" id="debug_page">
|
||||
<property name="icon-name">preferences-other-symbolic</property>
|
||||
<property name="title" translatable="yes">Debug</property>
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup" id="db_group">
|
||||
<property name="title" translatable="yes">Debug options</property>
|
||||
<child>
|
||||
<object class="AdwSwitchRow" id="debug_switch">
|
||||
<property name="title" translatable="yes">Debug logging</property>
|
||||
<property name="subtitle" translatable="yes">Enable logging to system journal</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwSwitchRow" id="revert_switch">
|
||||
<property name="title" translatable="yes">Always show new images</property>
|
||||
<property name="subtitle" translatable="yes">Switch to new images when available (unless on random mode)</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwSwitchRow" id="trash_purge_switch">
|
||||
<property name="title" translatable="yes">Purge on trash</property>
|
||||
<property name="subtitle" translatable="yes">Trashing an image will remove it from database</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwComboRow" id="resolutionEntry">
|
||||
<property name="title" translatable="yes">Screen resolution</property>
|
||||
<property name="subtitle" translatable="yes">Override automatic resolution selection</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwSpinRow" id="entry_random_interval">
|
||||
<property name="title" translatable="yes">Random interval</property>
|
||||
<property name="subtitle" translatable="yes">Custom shuffle interval when enabled</property>
|
||||
<property name="adjustment">
|
||||
<object class="GtkAdjustment" id="adjustment_random_interval">
|
||||
<property name="lower">300</property>
|
||||
<property name="upper">604800</property>
|
||||
<property name="page_increment">300</property>
|
||||
<property name="step_increment">3600</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup" id="js_group">
|
||||
<!-- <property name="title" translatable="yes">Presets</property> -->
|
||||
<child>
|
||||
<object class="AdwSwitchRow" id="always_export_switch">
|
||||
<property name="title" translatable="yes">Always export Bing data</property>
|
||||
<property name="subtitle" translatable="yes">Export Bing JSON when image data changes</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwActionRow" id="json_actionrow">
|
||||
<property name="title" translatable="yes">Bing JSON data</property>
|
||||
<property name="subtitle" translatable="yes">Custom shuffle interval when enabled</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="AdwPreferencesPage" id="about_page">
|
||||
<property name="icon-name">user-info-symbolic</property>
|
||||
<property name="title" translatable="yes">About</property>
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup" id="about_group">
|
||||
<!-- <property name="orientation">vertical</property>-->
|
||||
<child>
|
||||
<object class="GtkImage" id="app_icon_image">
|
||||
<property name="pixel-size">128</property>
|
||||
<property name="accessible-role">presentation</property>
|
||||
<style>
|
||||
<class name="icon-dropshadow"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="app_name_label">
|
||||
<property name="wrap">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="label" translatable="yes">Bing Wallpaper</property>
|
||||
<style>
|
||||
<class name="title-1"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="extension_description">
|
||||
<property name="can_focus">0</property>
|
||||
<property name="label" translatable="yes">New wallpaper images everyday from Bing</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="wrap">1</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkLabel" id="developer_name_label">
|
||||
<property name="wrap">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="label" translatable="yes">Maintained by Michael Carroll</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup" id="change_log_group">
|
||||
<child>
|
||||
<object class="AdwActionRow" id="details_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>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwExpanderRow" id="expander_row">
|
||||
<property name="title" translatable="yes">Release notes</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="change_log">
|
||||
<property name="wrap">True</property>
|
||||
<property name="justify">left</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup" id="about_details_group">
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup" id="details_group">
|
||||
|
||||
<child>
|
||||
<object class="AdwActionRow" id="extension_page_row">
|
||||
<property name="title" translatable="yes">GNOME extensions page</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="activatable">True</property>
|
||||
<property name="activatable-widget">extension_page_linkbutton</property>
|
||||
<child>
|
||||
<object class="GtkLinkButton" id="extension_page_linkbutton">
|
||||
<property name="uri">https://extensions.gnome.org/extension/1262/bing-wallpaper-changer/</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="icon-name">adw-external-link-symbolic</property>
|
||||
<property name="accessible-role">presentation</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwActionRow" id="source_code_row">
|
||||
<property name="title" translatable="yes">Source code</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="activatable">True</property>
|
||||
<property name="activatable-widget">source_code_linkbutton</property>
|
||||
<child>
|
||||
<object class="GtkLinkButton" id="source_code_linkbutton">
|
||||
<property name="uri">https://github.com/neffo/bing-wallpaper-gnome-extension</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="icon-name">adw-external-link-symbolic</property>
|
||||
<property name="accessible-role">presentation</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwActionRow" id="bug_report_row">
|
||||
<property name="title" translatable="yes">Report an issue</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="activatable">True</property>
|
||||
<property name="activatable-widget">bug_report_linkbutton</property>
|
||||
<child>
|
||||
<object class="GtkLinkButton" id="bug_report_linkbutton">
|
||||
<property name="uri">https://github.com/neffo/bing-wallpaper-gnome-extension/issues</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="icon-name">adw-external-link-symbolic</property>
|
||||
<property name="accessible-role">presentation</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwActionRow" id="contributors_row">
|
||||
<property name="title" translatable="yes">Contributors</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="activatable">True</property>
|
||||
<property name="activatable-widget">contributors_linkbutton</property>
|
||||
<child>
|
||||
<object class="GtkLinkButton" id="contributors_linkbutton">
|
||||
<property name="uri">https://github.com/neffo/bing-wallpaper-gnome-extension/graphs/contributors</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="icon-name">adw-external-link-symbolic</property>
|
||||
<property name="accessible-role">presentation</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwExpanderRow" id="license_expander">
|
||||
<property name="title" translatable="yes">License</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="license">
|
||||
<property name="wrap">True</property>
|
||||
<property name="justify">left</property>
|
||||
<property name="label">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.</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkFileDialog" id="folderDialog">
|
||||
<property name="accept-label" translatable="yes">Change folder</property>
|
||||
<property name="modal">true</property>
|
||||
<property name="title" translatable="yes">Select new wallpaper download folder</property>
|
||||
</object>
|
||||
</interface>
|
||||
|
||||
<!-- <signal name="clicked" handler="open_wp_folder" /> -->
|
||||
@ -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 = [];
|
||||
|
||||
Reference in New Issue
Block a user