diff --git a/data/hu.kramo.Cartridges.gschema.xml b/data/hu.kramo.Cartridges.gschema.xml
index 23d1ae6..108e336 100644
--- a/data/hu.kramo.Cartridges.gschema.xml
+++ b/data/hu.kramo.Cartridges.gschema.xml
@@ -19,6 +19,9 @@
[]
+
+ true
+
true
diff --git a/po/cartridges.pot b/po/cartridges.pot
index e48bc9a..cabed98 100644
--- a/po/cartridges.pot
+++ b/po/cartridges.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Cartridges\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2023-03-31 16:40+0200\n"
+"POT-Creation-Date: 2023-04-02 17:04+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
@@ -56,11 +56,11 @@ msgid "Game Details"
msgstr ""
#: data/hu.kramo.Cartridges.metainfo.xml.in:34 data/gtk/window.blp:363
-#: src/utils/importer.py:81
+#: src/utils/importer.py:77 src/utils/importer.py:122
msgid "Preferences"
msgstr ""
-#: data/gtk/window.blp:6 src/utils/importer.py:78
+#: data/gtk/window.blp:6 src/utils/importer.py:74
msgid "No Games Found"
msgstr ""
@@ -92,7 +92,7 @@ msgstr ""
msgid "Game Title"
msgstr ""
-#: data/gtk/window.blp:148 src/game.py:175
+#: data/gtk/window.blp:148 src/game.py:168
msgid "Play"
msgstr ""
@@ -188,7 +188,7 @@ msgstr ""
msgid "Shortcuts"
msgstr ""
-#: data/gtk/help-overlay.blp:34 src/main.py:202 src/preferences.py:123
+#: data/gtk/help-overlay.blp:34 src/main.py:206 src/preferences.py:121
msgid "Undo"
msgstr ""
@@ -265,7 +265,7 @@ msgstr ""
msgid "Directory to use when importing games"
msgstr ""
-#: data/gtk/preferences.blp:86
+#: data/gtk/preferences.blp:86 src/utils/importer.py:117
msgid "Extra Steam Libraries"
msgstr ""
@@ -327,91 +327,97 @@ msgid "translator_credits"
msgstr ""
#. The variable is the title of the game
-#: src/main.py:201
+#: src/main.py:205
msgid "{} removed"
msgstr ""
-#: src/window.py:234
+#: src/window.py:239
msgid "Today"
msgstr ""
-#: src/window.py:236
+#: src/window.py:241
msgid "Yesterday"
msgstr ""
#. The variable is the date when the game was added
-#: src/window.py:270
+#: src/window.py:275
msgid "Added: {}"
msgstr ""
-#: src/window.py:275
+#: src/window.py:280
msgid "Never"
msgstr ""
#. The variable is the date when the game was last played
-#: src/window.py:279
+#: src/window.py:284
msgid "Last played: {}"
msgstr ""
-#: src/game.py:173
+#: src/game.py:166
msgid "Details"
msgstr ""
-#: src/preferences.py:55
+#: src/preferences.py:53
msgid "Installation Not Found"
msgstr ""
#. The variable is the name of the game launcher
-#: src/preferences.py:57
+#: src/preferences.py:55
msgid "Select the {} configuration directory."
msgstr ""
#. The variable is the name of the game launcher
-#: src/preferences.py:60
+#: src/preferences.py:58
msgid "Select the {} data directory."
msgstr ""
-#: src/preferences.py:62 src/preferences.py:224
+#: src/preferences.py:60 src/preferences.py:222
msgid "Set Location"
msgstr ""
-#: src/preferences.py:122
+#: src/preferences.py:120
msgid "All games removed"
msgstr ""
-#: src/preferences.py:221
+#: src/preferences.py:219
msgid "Cache Not Found"
msgstr ""
-#: src/preferences.py:222
+#: src/preferences.py:220
msgid "Select the Lutris cache directory."
msgstr ""
-#: src/utils/importer.py:37
+#: src/utils/importer.py:39
msgid "Importing Games…"
msgstr ""
-#: src/utils/importer.py:79
+#: src/utils/importer.py:75
msgid "No new games were found on your system."
msgstr ""
-#: src/utils/importer.py:87
+#: src/utils/importer.py:83
msgid "Game Imported"
msgstr ""
-#: src/utils/importer.py:88
+#: src/utils/importer.py:84
msgid "Successfully imported 1 game."
msgstr ""
-#: src/utils/importer.py:94
+#: src/utils/importer.py:90
msgid "Games Imported"
msgstr ""
#. The variable is the number of games
-#: src/utils/importer.py:96
+#: src/utils/importer.py:92
msgid "Successfully imported {} games."
msgstr ""
+#: src/utils/importer.py:119
+msgid ""
+"Looks like you have multiple Steam libraries. Would you like to add them in "
+"preferences?"
+msgstr ""
+
#: src/utils/create_details_window.py:41
msgid "Add New Game"
msgstr ""
diff --git a/src/main.py b/src/main.py
index b13c000..5ab9187 100644
--- a/src/main.py
+++ b/src/main.py
@@ -127,10 +127,14 @@ class CartridgesApplication(Adw.Application):
)
about.present()
- def on_preferences_action(self, _widget, _callback=None, page_name=None):
+ def on_preferences_action(
+ self, _widget, _callback=None, page_name=None, expander_row=None
+ ):
win = PreferencesWindow(self.win)
if page_name:
win.set_visible_page_name(page_name)
+ if expander_row:
+ getattr(win, expander_row).set_expanded(True)
win.present()
def on_launch_game_action(self, _widget, _callback=None):
diff --git a/src/utils/importer.py b/src/utils/importer.py
index 02a4a51..894525d 100644
--- a/src/utils/importer.py
+++ b/src/utils/importer.py
@@ -17,6 +17,8 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
+from pathlib import Path
+
from gi.repository import Adw, Gtk
from .create_dialog import create_dialog
@@ -66,12 +68,6 @@ class Importer:
if self.queue == 0 and not self.blocker:
self.import_dialog.close()
- def response(_widget, response):
- if response == "open_preferences":
- self.parent_widget.get_application().on_preferences_action(
- None, page_name="import"
- )
-
if self.games_no == 0:
create_dialog(
self.parent_widget,
@@ -79,14 +75,14 @@ class Importer:
_("No new games were found on your system."),
"open_preferences",
_("Preferences"),
- ).connect("response", response)
+ ).connect("response", self.response)
elif self.games_no == 1:
create_dialog(
self.parent_widget,
_("Game Imported"),
_("Successfully imported 1 game."),
- )
+ ).connect("response", self.response)
elif self.games_no > 1:
games_no = self.games_no
create_dialog(
@@ -94,4 +90,34 @@ class Importer:
_("Games Imported"),
# The variable is the number of games
_("Successfully imported {} games.").format(games_no),
- )
+ ).connect("response", self.response)
+
+ def response(self, _widget, response, expander_row=None):
+ if response == "open_preferences":
+ self.parent_widget.get_application().on_preferences_action(
+ None, page_name="import", expander_row=expander_row
+ )
+ elif (
+ self.parent_widget.schema.get_boolean("steam")
+ and self.parent_widget.schema.get_boolean("steam-extra-dirs-hint")
+ and not self.parent_widget.schema.get_strv("steam-extra-dirs")
+ ):
+ steam_library_path = (
+ Path(self.parent_widget.schema.get_string("steam-location"))
+ / "steamapps"
+ / "libraryfolders.vdf"
+ )
+ if (
+ steam_library_path.exists()
+ and steam_library_path.read_text("utf-8").count('"path"') > 1
+ ):
+ self.parent_widget.schema.set_boolean("steam-extra-dirs-hint", False)
+ create_dialog(
+ self.parent_widget,
+ _("Extra Steam Libraries"),
+ _(
+ "Looks like you have multiple Steam libraries. Would you like to add them in preferences?"
+ ),
+ "open_preferences",
+ _("Preferences"),
+ ).connect("response", self.response, "steam_expander_row")