diff --git a/randomwallpaper@iflow.space/prefs.js b/randomwallpaper@iflow.space/prefs.js index b00abcc..eb71770 100644 --- a/randomwallpaper@iflow.space/prefs.js +++ b/randomwallpaper@iflow.space/prefs.js @@ -161,6 +161,10 @@ const RandomWallpaperSettings = new Lang.Class({ this._builder.get_object('unsplash-image-height'), 'value', Gio.SettingsBindFlags.DEFAULT); + this._unsplash_settings.bind('featured-only', + this._builder.get_object('unsplash-featured-only'), + 'active', + Gio.SettingsBindFlags.DEFAULT); }, bindWallheaven: function () { diff --git a/randomwallpaper@iflow.space/schemas/gschemas.compiled b/randomwallpaper@iflow.space/schemas/gschemas.compiled index 4ee1798..b0ca0b1 100644 Binary files a/randomwallpaper@iflow.space/schemas/gschemas.compiled and b/randomwallpaper@iflow.space/schemas/gschemas.compiled differ diff --git a/randomwallpaper@iflow.space/schemas/org.gnome.shell.extensions.space.iflow.randomwallpaper.gschema.xml b/randomwallpaper@iflow.space/schemas/org.gnome.shell.extensions.space.iflow.randomwallpaper.gschema.xml index ec17645..a1e53e8 100644 --- a/randomwallpaper@iflow.space/schemas/org.gnome.shell.extensions.space.iflow.randomwallpaper.gschema.xml +++ b/randomwallpaper@iflow.space/schemas/org.gnome.shell.extensions.space.iflow.randomwallpaper.gschema.xml @@ -94,6 +94,11 @@ Image Width The height of the image. + + false + Featured images only + This results in a smaller wallpaper pool but the images are considered to have higher quality. + True True end - center + start 1 diff --git a/randomwallpaper@iflow.space/sourceAdapter.js b/randomwallpaper@iflow.space/sourceAdapter.js index 3305226..59b4f46 100644 --- a/randomwallpaper@iflow.space/sourceAdapter.js +++ b/randomwallpaper@iflow.space/sourceAdapter.js @@ -95,6 +95,7 @@ let UnsplashAdapter = new Lang.Class({ 'query': '', 'w': 1920, 'h': 1080, + 'featured': false }, _init: function () { @@ -152,12 +153,14 @@ let UnsplashAdapter = new Lang.Class({ this.options.query = this._settings.get('unsplash-keyword', 'string'); this.options.username = this._settings.get('username', 'string'); - if (this.options.username[0] === '@') { + if (this.options.username && this.options.username[0] === '@') { this.options.username = this.options.username.substring(1); // remove @ prefix } this.options.w = this._settings.get('image-width', 'int'); this.options.h = this._settings.get('image-height', 'int'); + + this.options.featured = this._settings.get('featured-only', 'boolean'); } }); diff --git a/randomwallpaper@iflow.space/wallpaperController.js b/randomwallpaper@iflow.space/wallpaperController.js index 86a0c7f..a453c4b 100644 --- a/randomwallpaper@iflow.space/wallpaperController.js +++ b/randomwallpaper@iflow.space/wallpaperController.js @@ -178,7 +178,8 @@ let WallpaperController = new Lang.Class({ */ if (settings.is_writable("picture-uri")) { // Set a new Background-Image (should show up immediately): - if (settings.set_string("picture-uri", path)) { + let rc = settings.set_string("picture-uri", path); + if (rc) { Gio.Settings.sync(); // Necessary: http://stackoverflow.com/questions/9985140 // call callback if given