mirror of
https://github.com/Hopiu/RandomWallpaperGnome3.git
synced 2026-03-16 22:20:24 +00:00
parent
a91629c23e
commit
07ecf7f932
6 changed files with 45 additions and 44 deletions
|
|
@ -14,7 +14,7 @@ const Gettext = imports.gettext.domain('space.iflow.randomwallpaper');
|
|||
const RWG_SETTINGS_SCHEMA = 'org.gnome.shell.extensions.space.iflow.randomwallpaper';
|
||||
const RWG_SETTINGS_SCHEMA_DESKTOPPER = 'org.gnome.shell.extensions.space.iflow.randomwallpaper.desktopper';
|
||||
const RWG_SETTINGS_SCHEMA_UNSPLASH = 'org.gnome.shell.extensions.space.iflow.randomwallpaper.unsplash';
|
||||
const RWG_SETTINGS_SCHEMA_WALLHEAVEN = 'org.gnome.shell.extensions.space.iflow.randomwallpaper.wallheaven';
|
||||
const RWG_SETTINGS_SCHEMA_WALLHAVEN = 'org.gnome.shell.extensions.space.iflow.randomwallpaper.wallhaven';
|
||||
const RWG_SETTINGS_SCHEMA_GENERIC_JSON = 'org.gnome.shell.extensions.space.iflow.randomwallpaper.genericJSON';
|
||||
|
||||
const LoggerModule = Self.imports.logger;
|
||||
|
|
@ -41,7 +41,7 @@ var RandomWallpaperSettings = new Lang.Class({
|
|||
noSettings: null,
|
||||
desktopperSettings: null,
|
||||
unsplashSettings: null,
|
||||
wallheavenSettings: null,
|
||||
wallhavenSettings: null,
|
||||
genericJsonSettings: null,
|
||||
|
||||
_init: function () {
|
||||
|
|
@ -64,10 +64,10 @@ var RandomWallpaperSettings = new Lang.Class({
|
|||
this.unsplashSettings = this._builder.get_object('unsplash-settings');
|
||||
this.bindUnsplash();
|
||||
|
||||
// Wallheaven Settings
|
||||
this._wallheaven_settings = Convenience.getSettings(RWG_SETTINGS_SCHEMA_WALLHEAVEN);
|
||||
this.wallheavenSettings = this._builder.get_object('wallheaven-settings');
|
||||
this.bindWallheaven();
|
||||
// Wallhaven Settings
|
||||
this._wallhaven_settings = Convenience.getSettings(RWG_SETTINGS_SCHEMA_WALLHAVEN);
|
||||
this.wallhavenSettings = this._builder.get_object('wallhaven-settings');
|
||||
this.bindWallhaven();
|
||||
|
||||
// Generic JSON Settings
|
||||
this._generic_json_settings = Convenience.getSettings(RWG_SETTINGS_SCHEMA_GENERIC_JSON);
|
||||
|
|
@ -95,8 +95,8 @@ var RandomWallpaperSettings = new Lang.Class({
|
|||
case 1: // desktopper
|
||||
this.currentSourceSettingsWidget = this.desktopperSettings;
|
||||
break;
|
||||
case 2: // wallheaven
|
||||
this.currentSourceSettingsWidget = this.wallheavenSettings;
|
||||
case 2: // wallhaven
|
||||
this.currentSourceSettingsWidget = this.wallhavenSettings;
|
||||
break;
|
||||
case 3: // generic JSON
|
||||
this.currentSourceSettingsWidget = this.genericJsonSettings;
|
||||
|
|
@ -180,35 +180,35 @@ var RandomWallpaperSettings = new Lang.Class({
|
|||
Gio.SettingsBindFlags.DEFAULT);
|
||||
},
|
||||
|
||||
bindWallheaven: function () {
|
||||
this._wallheaven_settings.bind('wallheaven-keyword',
|
||||
this._builder.get_object('wallheaven-keyword'),
|
||||
bindWallhaven: function () {
|
||||
this._wallhaven_settings.bind('wallhaven-keyword',
|
||||
this._builder.get_object('wallhaven-keyword'),
|
||||
'text',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
this._wallheaven_settings.bind('resolutions',
|
||||
this._builder.get_object('wallheaven-resolutions'),
|
||||
this._wallhaven_settings.bind('resolutions',
|
||||
this._builder.get_object('wallhaven-resolutions'),
|
||||
'text',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
this._wallheaven_settings.bind('category-general',
|
||||
this._builder.get_object('wallheaven-category-general'),
|
||||
this._wallhaven_settings.bind('category-general',
|
||||
this._builder.get_object('wallhaven-category-general'),
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
this._wallheaven_settings.bind('category-anime',
|
||||
this._builder.get_object('wallheaven-category-anime'),
|
||||
this._wallhaven_settings.bind('category-anime',
|
||||
this._builder.get_object('wallhaven-category-anime'),
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
this._wallheaven_settings.bind('category-people',
|
||||
this._builder.get_object('wallheaven-category-people'),
|
||||
this._wallhaven_settings.bind('category-people',
|
||||
this._builder.get_object('wallhaven-category-people'),
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
this._wallheaven_settings.bind('allow-sfw',
|
||||
this._builder.get_object('wallheaven-allow-sfw'),
|
||||
this._wallhaven_settings.bind('allow-sfw',
|
||||
this._builder.get_object('wallhaven-allow-sfw'),
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
this._wallheaven_settings.bind('allow-sketchy',
|
||||
this._builder.get_object('wallheaven-allow-sketchy'),
|
||||
this._wallhaven_settings.bind('allow-sketchy',
|
||||
this._builder.get_object('wallhaven-allow-sketchy'),
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
},
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -4,7 +4,7 @@
|
|||
<enum id='org.gnome.shell.extensions.space.iflow.randomwallpaper.sources'>
|
||||
<value value='0' nick='unsplash'/>
|
||||
<value value='1' nick='desktoppr'/>
|
||||
<value value='2' nick='wallheaven'/>
|
||||
<value value='2' nick='wallhaven'/>
|
||||
<value value='3' nick='genericJSON'/>
|
||||
</enum>
|
||||
|
||||
|
|
@ -109,8 +109,8 @@
|
|||
</schema>
|
||||
|
||||
<schema path="/org/gnome/shell/extensions/space-iflow-randomwallpaper-sources/"
|
||||
id='org.gnome.shell.extensions.space.iflow.randomwallpaper.wallheaven'>
|
||||
<key type='s' name='wallheaven-keyword'>
|
||||
id='org.gnome.shell.extensions.space.iflow.randomwallpaper.wallhaven'>
|
||||
<key type='s' name='wallhaven-keyword'>
|
||||
<default>""</default>
|
||||
<summary>Keyword</summary>
|
||||
<description>The keyword will be used to search images.</description>
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ You can also define a prefix that will be added to the image URL.</property>
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">The source that is used to fetch random wallpapers. You can select between unsplash.com, desktoppr.co, wallheaven.cc and a generic JSON source for experienced users.</property>
|
||||
<property name="label" translatable="yes">The source that is used to fetch random wallpapers. You can select between unsplash.com, desktoppr.co, wallhaven.cc and a generic JSON source for experienced users.</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="max_width_chars">1</property>
|
||||
<property name="xalign">0</property>
|
||||
|
|
@ -316,7 +316,7 @@ You can also define a prefix that will be added to the image URL.</property>
|
|||
<items>
|
||||
<item id="unsplash">unsplash.com</item>
|
||||
<item id="desktoppr">desktoppr.co</item>
|
||||
<item id="wallheaven">alpha.wallheaven.cc</item>
|
||||
<item id="wallhaven">alpha.wallhaven.cc</item>
|
||||
<item id="genericJSON" translatable="yes">Generic JSON</item>
|
||||
</items>
|
||||
</object>
|
||||
|
|
@ -1187,7 +1187,7 @@ You can also define a prefix that will be added to the image URL.</property>
|
|||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkBox" id="wallheaven-settings">
|
||||
<object class="GtkBox" id="wallhaven-settings">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">10</property>
|
||||
|
|
@ -1209,7 +1209,7 @@ You can also define a prefix that will be added to the image URL.</property>
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="wallheaven-keyword">
|
||||
<object class="GtkEntry" id="wallhaven-keyword">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="margin_bottom">10</property>
|
||||
|
|
@ -1241,7 +1241,7 @@ You can also define a prefix that will be added to the image URL.</property>
|
|||
<property name="margin_bottom">10</property>
|
||||
<property name="layout_style">start</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="wallheaven-allow-sfw">
|
||||
<object class="GtkCheckButton" id="wallhaven-allow-sfw">
|
||||
<property name="label" translatable="yes">SFW (Safe for work)</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
|
|
@ -1255,7 +1255,7 @@ You can also define a prefix that will be added to the image URL.</property>
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="wallheaven-allow-sketchy">
|
||||
<object class="GtkCheckButton" id="wallhaven-allow-sketchy">
|
||||
<property name="label" translatable="yes">Sketchy</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
|
|
@ -1295,7 +1295,7 @@ You can also define a prefix that will be added to the image URL.</property>
|
|||
<property name="margin_bottom">10</property>
|
||||
<property name="layout_style">start</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="wallheaven-category-general">
|
||||
<object class="GtkCheckButton" id="wallhaven-category-general">
|
||||
<property name="label" translatable="yes">General</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
|
|
@ -1309,7 +1309,7 @@ You can also define a prefix that will be added to the image URL.</property>
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="wallheaven-category-anime">
|
||||
<object class="GtkCheckButton" id="wallhaven-category-anime">
|
||||
<property name="label" translatable="yes">Anime</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
|
|
@ -1323,7 +1323,7 @@ You can also define a prefix that will be added to the image URL.</property>
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="wallheaven-category-people">
|
||||
<object class="GtkCheckButton" id="wallhaven-category-people">
|
||||
<property name="label" translatable="yes">People</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
|
|
@ -1357,7 +1357,7 @@ You can also define a prefix that will be added to the image URL.</property>
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="wallheaven-resolutions">
|
||||
<object class="GtkEntry" id="wallhaven-resolutions">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="placeholder_text" translatable="yes">1920x1080, 1920x1200</property>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ const Json = imports.gi.Json;
|
|||
|
||||
const RWG_SETTINGS_SCHEMA_DESKTOPPER = 'org.gnome.shell.extensions.space.iflow.randomwallpaper.desktopper';
|
||||
const RWG_SETTINGS_SCHEMA_UNSPLASH = 'org.gnome.shell.extensions.space.iflow.randomwallpaper.unsplash';
|
||||
const RWG_SETTINGS_SCHEMA_WALLHEAVEN = 'org.gnome.shell.extensions.space.iflow.randomwallpaper.wallheaven';
|
||||
const RWG_SETTINGS_SCHEMA_WALLHAVEN = 'org.gnome.shell.extensions.space.iflow.randomwallpaper.wallhaven';
|
||||
const RWG_SETTINGS_SCHEMA_GENERIC_JSON = 'org.gnome.shell.extensions.space.iflow.randomwallpaper.genericJSON';
|
||||
|
||||
const SettingsModule = Self.imports.settings;
|
||||
|
|
@ -177,8 +177,8 @@ var UnsplashAdapter = new Lang.Class({
|
|||
}
|
||||
});
|
||||
|
||||
var WallheavenAdapter = new Lang.Class({
|
||||
Name: "WallheavenAdapter",
|
||||
var WallhavenAdapter = new Lang.Class({
|
||||
Name: "WallhavenAdapter",
|
||||
Extends: BaseAdapter,
|
||||
_settings: null,
|
||||
|
||||
|
|
@ -194,7 +194,7 @@ var WallheavenAdapter = new Lang.Class({
|
|||
_init: function () {
|
||||
this.parent();
|
||||
|
||||
this._settings = new SettingsModule.Settings(RWG_SETTINGS_SCHEMA_WALLHEAVEN);
|
||||
this._settings = new SettingsModule.Settings(RWG_SETTINGS_SCHEMA_WALLHAVEN);
|
||||
},
|
||||
|
||||
requestRandomImage: function (callback) {
|
||||
|
|
@ -231,6 +231,7 @@ var WallheavenAdapter = new Lang.Class({
|
|||
if (callback) {
|
||||
let historyEntry = new HistoryModule.HistoryEntry(null, 'wallhaven.cc', imageDownloadUrl);
|
||||
historyEntry.source.sourceUrl = 'https://alpha.wallhaven.cc/';
|
||||
historyEntry.source.imageLinkUrl = url;
|
||||
callback(historyEntry);
|
||||
}
|
||||
})
|
||||
|
|
@ -259,7 +260,7 @@ var WallheavenAdapter = new Lang.Class({
|
|||
},
|
||||
|
||||
_readOptionsFromSettings: function () {
|
||||
this.options.q = this._settings.get('wallheaven-keyword', 'string');
|
||||
this.options.q = this._settings.get('wallhaven-keyword', 'string');
|
||||
|
||||
this.options.resolutions = this._settings.get('resolutions', 'string').split(',');
|
||||
this.options.resolutions = this.options.resolutions.map((elem) => {
|
||||
|
|
@ -275,7 +276,7 @@ var WallheavenAdapter = new Lang.Class({
|
|||
let purity = [];
|
||||
purity.push(+this._settings.get('allow-sfw', 'boolean'));
|
||||
purity.push(+this._settings.get('allow-sketchy', 'boolean'));
|
||||
purity.push(0); // required by wallheaven
|
||||
purity.push(0); // required by wallhaven
|
||||
this.options.purity = purity.join('');
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ var WallpaperController = new Lang.Class({
|
|||
|
||||
this._desktopperAdapter = new SourceAdapter.DesktopperAdapter();
|
||||
this._unsplashAdapter = new SourceAdapter.UnsplashAdapter();
|
||||
this._wallheavenAdapter = new SourceAdapter.WallheavenAdapter();
|
||||
this._wallhavenAdapter = new SourceAdapter.WallhavenAdapter();
|
||||
this._genericJsonAdapter = new SourceAdapter.GenericJsonAdapter();
|
||||
|
||||
this.logger = new LoggerModule.Logger('RWG3', 'WallpaperController');
|
||||
|
|
@ -97,7 +97,7 @@ var WallpaperController = new Lang.Class({
|
|||
this.imageSourceAdapter = this._desktopperAdapter;
|
||||
break;
|
||||
case 2:
|
||||
this.imageSourceAdapter = this._wallheavenAdapter;
|
||||
this.imageSourceAdapter = this._wallhavenAdapter;
|
||||
break;
|
||||
case 3:
|
||||
this.imageSourceAdapter = this._genericJsonAdapter;
|
||||
|
|
|
|||
Loading…
Reference in a new issue