mirror of
https://github.com/Hopiu/RandomWallpaperGnome3.git
synced 2026-05-18 20:11:08 +00:00
Add prefix for image url. This is needed for relative urls that do not contain the domain (e.g.: Bing picture of the day). Closes #22
This commit is contained in:
parent
79685069b8
commit
1d71ac073d
5 changed files with 47 additions and 0 deletions
|
|
@ -224,6 +224,10 @@ const RandomWallpaperSettings = new Lang.Class({
|
|||
this._builder.get_object('generic-json-response-path'),
|
||||
'text',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
this._generic_json_settings.bind('generic-json-url-prefix',
|
||||
this._builder.get_object('generic-json-url-prefix'),
|
||||
'text',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -160,6 +160,11 @@
|
|||
<summary>JSON Path</summary>
|
||||
<description>The JSON path that describes the picture URL.</description>
|
||||
</key>
|
||||
<key type='s' name='generic-json-url-prefix'>
|
||||
<default>""</default>
|
||||
<summary>Image URL prefix</summary>
|
||||
<description>This prefix is added to the final image URL.</description>
|
||||
</key>
|
||||
</schema>
|
||||
|
||||
</schemalist>
|
||||
|
|
|
|||
|
|
@ -153,6 +153,43 @@ You have to specify an URL to a JSON response and a path to the target picture u
|
|||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Image URL prefix</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="generic-json-url-prefix">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="placeholder_text" translatable="yes">Image URL prefix</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="history-length">
|
||||
<property name="lower">1</property>
|
||||
|
|
|
|||
|
|
@ -296,6 +296,7 @@ let GenericJsonAdapter = new Lang.Class({
|
|||
let response = JSON.parse(message.response_body.data);
|
||||
let JSONPath = this._settings.get("generic-json-response-path", "string");
|
||||
let imageUrl = this._jsonPathParser.access(response, JSONPath);
|
||||
imageUrl = this._settings.get("generic-json-url-prefix", "string")+imageUrl;
|
||||
|
||||
if (callback) {
|
||||
let historyEntry = new HistoryModule.HistoryEntry(null, 'Generic JSON Source', imageUrl);
|
||||
|
|
|
|||
Loading…
Reference in a new issue