Add option to import Steam games from Lutris

This commit is contained in:
kramo
2023-04-05 10:13:22 +02:00
parent 41f7ce3d5f
commit 725e4027f2
4 changed files with 20 additions and 1 deletions

View File

@@ -121,6 +121,7 @@ template PreferencesWindow : Adw.PreferencesWindow {
valign: center;
}
}
Adw.ActionRow {
title: _("Lutris Cache Location");
subtitle: _("Directory to use when importing game covers");
@@ -130,6 +131,14 @@ template PreferencesWindow : Adw.PreferencesWindow {
valign: center;
}
}
Adw.ActionRow {
title: _("Import Steam Games");
Switch lutris_steam_switch {
valign: center;
}
}
}
Adw.ExpanderRow heroic_expander_row {

View File

@@ -31,6 +31,9 @@
<key name="lutris-cache-location" type="s">
<default>"~/.var/app/net.lutris.Lutris/cache/lutris"</default>
</key>
<key name="lutris-import-steam" type="b">
<default>false</default>
</key>
<key name="heroic" type="b">
<default>true</default>
</key>

View File

@@ -101,6 +101,7 @@ class PreferencesWindow(Adw.PreferencesWindow):
lutris_expander_row = Gtk.Template.Child()
lutris_file_chooser_button = Gtk.Template.Child()
lutris_cache_file_chooser_button = Gtk.Template.Child()
lutris_steam_switch = Gtk.Template.Child()
heroic_expander_row = Gtk.Template.Child()
heroic_file_chooser_button = Gtk.Template.Child()
@@ -213,6 +214,12 @@ class PreferencesWindow(Adw.PreferencesWindow):
self.lutris_expander_row,
self.lutris_file_chooser_button,
)
self.schema.bind(
"lutris-import-steam",
self.lutris_steam_switch,
"active",
Gio.SettingsBindFlags.DEFAULT,
)
def set_cache_dir(_source, result, _unused):
try:

View File

@@ -83,7 +83,7 @@ def lutris_parser(parent_widget):
# No need to unlink temp files as they disappear when the connection is closed
database_tmp_path.unlink(missing_ok=True)
if schema.get_boolean("steam"):
if not schema.get_boolean("lutris-import-steam"):
rows = [row for row in rows if not row[3] == "steam"]
current_time = int(time())