SteamGridDB cleanups

This commit is contained in:
kramo
2023-04-05 00:08:30 +02:00
parent b942fd7d3c
commit ee0c07befc
4 changed files with 15 additions and 7 deletions

View File

@@ -210,7 +210,6 @@ template PreferencesWindow : Adw.PreferencesWindow {
Adw.PreferencesGroup sgdb_key_group {
title: _("Authentication");
description: _("An API Key is required to use SteamGridDB. You can generate one <a href=\"https://www.steamgriddb.com/profile/preferences/api\">here</a>.");
Adw.EntryRow sgdb_key_entry_row {
title: _("API Key");
@@ -221,7 +220,7 @@ template PreferencesWindow : Adw.PreferencesWindow {
title: _("Behavior");
Adw.ActionRow {
title: _("Download Images Automatically");
title: _("Use SteamGridDB");
subtitle: _("Download images when adding or importing games");
Switch sgdb_download_switch {

View File

@@ -61,7 +61,7 @@
<key name="sgdb-key" type="s">
<default>""</default>
</key>
<key name="sgdb-import" type="b">
<key name="sgdb" type="b">
<default>false</default>
</key>
<key name="sgdb-prefer" type="b">

View File

@@ -114,6 +114,7 @@ class PreferencesWindow(Adw.PreferencesWindow):
itch_expander_row = Gtk.Template.Child()
itch_file_chooser_button = Gtk.Template.Child()
sgdb_key_group = Gtk.Template.Child()
sgdb_key_entry_row = Gtk.Template.Child()
sgdb_download_switch = Gtk.Template.Child()
sgdb_prefer_switch = Gtk.Template.Child()
@@ -303,7 +304,7 @@ class PreferencesWindow(Adw.PreferencesWindow):
# SteamGridDB
self.schema.bind(
"sgdb-import",
"sgdb",
self.sgdb_download_switch,
"active",
Gio.SettingsBindFlags.DEFAULT,
@@ -322,6 +323,14 @@ class PreferencesWindow(Adw.PreferencesWindow):
self.sgdb_key_entry_row.set_text(self.schema.get_string("sgdb-key"))
self.sgdb_key_entry_row.connect("changed", sgdb_key_changed)
self.sgdb_key_group.set_description(
_(
"An API Key is required to use SteamGridDB. You can generate one {}here{}."
).format(
'<a href="https://www.steamgriddb.com/profile/preferences/api">', "</a>"
)
)
def choose_folder(self, _widget, function):
self.file_chooser.select_folder(self.parent_widget, None, function, None)

View File

@@ -29,9 +29,9 @@ class SGDBSave:
Gio.Task.new(None, None, self.task_done).run_in_thread(create_func(game))
def update_cover(self, task, game):
if self.parent_widget.schema.get_boolean("sgdb-prefer") or (
self.parent_widget.schema.get_boolean("sgdb-import")
and not (
if self.parent_widget.schema.get_boolean("sgdb") and (
self.parent_widget.schema.get_boolean("sgdb-prefer")
or not (
self.parent_widget.data_dir
/ "cartridges"
/ "covers"