diff --git a/randomwallpaper@iflow.space/prefs.js b/randomwallpaper@iflow.space/prefs.js index 94829e1..9a373aa 100644 --- a/randomwallpaper@iflow.space/prefs.js +++ b/randomwallpaper@iflow.space/prefs.js @@ -161,11 +161,14 @@ var RandomWallpaperSettings = new Lang.Class({ this._builder.get_object('unsplash-keyword'), 'text', Gio.SettingsBindFlags.DEFAULT); - this._unsplash_settings.bind('username', + this._unsplash_settings.bind('unsplash-username', this._builder.get_object('unsplash-username'), 'text', Gio.SettingsBindFlags.DEFAULT); - + this._unsplash_settings.bind('unsplash-collections', + this._builder.get_object('unsplash-collections'), + 'text', + Gio.SettingsBindFlags.DEFAULT); this._unsplash_settings.bind('image-width', this._builder.get_object('unsplash-image-width'), 'value', diff --git a/randomwallpaper@iflow.space/schemas/gschemas.compiled b/randomwallpaper@iflow.space/schemas/gschemas.compiled index ec85d22..5ec9035 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 6848933..9bc4ce2 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 @@ -87,11 +87,16 @@ Keyword The keyword will be used to search images. - + "" Username Only fetch random images of a given user. + + "" + Collections + Only fetch random images from a comma separated list of collections. + 1920 Image Width diff --git a/randomwallpaper@iflow.space/settings.ui b/randomwallpaper@iflow.space/settings.ui index b4f0d43..3248240 100644 --- a/randomwallpaper@iflow.space/settings.ui +++ b/randomwallpaper@iflow.space/settings.ui @@ -1,5 +1,5 @@ - + @@ -1007,7 +1007,7 @@ You can also define a prefix that will be added to the image URL. True False start - Keyword + Collections False @@ -1016,11 +1016,11 @@ You can also define a prefix that will be added to the image URL. - + True True 10 - Enter a keyword ... + ID1, ID2, ... False @@ -1028,6 +1028,32 @@ You can also define a prefix that will be added to the image URL. 3 + + + True + False + start + Keyword + + + False + True + 4 + + + + + True + True + 10 + Some keyword ... + + + False + True + 5 + + True @@ -1116,7 +1142,7 @@ You can also define a prefix that will be added to the image URL. False True - 4 + 6 @@ -1183,7 +1209,7 @@ You can also define a prefix that will be added to the image URL. False True 10 - 5 + 7 diff --git a/randomwallpaper@iflow.space/sourceAdapter.js b/randomwallpaper@iflow.space/sourceAdapter.js index 12ac24b..c4ec1fc 100644 --- a/randomwallpaper@iflow.space/sourceAdapter.js +++ b/randomwallpaper@iflow.space/sourceAdapter.js @@ -51,7 +51,7 @@ var BaseAdapter = new Lang.Class({ try { return uri !== decodeURIComponent(uri); - } catch(err) { + } catch (err) { this.logger.error(err); return false; } @@ -112,6 +112,7 @@ var UnsplashAdapter = new Lang.Class({ options: { 'username': '', 'query': '', + 'collections': [], 'w': 1920, 'h': 1080, 'featured': false @@ -179,11 +180,16 @@ var UnsplashAdapter = new Lang.Class({ _readOptionsFromSettings: function () { this.options.query = this._settings.get('unsplash-keyword', 'string'); - this.options.username = this._settings.get('username', 'string'); + this.options.username = this._settings.get('unsplash-username', 'string'); if (this.options.username && this.options.username[0] === '@') { this.options.username = this.options.username.substring(1); // remove @ prefix } + this.options.collections = this._settings.get('unsplash-collections', 'string').split(',').map( + (elem) => { + return elem.trim(); + }); + this.options.w = this._settings.get('image-width', 'int'); this.options.h = this._settings.get('image-height', 'int');