Allow a custom number of library rows - fixes #173

This commit is contained in:
kramo
2023-08-26 17:33:30 +02:00
parent 89862ae266
commit 5364e6a320
2 changed files with 18 additions and 0 deletions

View File

@@ -116,6 +116,9 @@
<key name="sgdb-animated" type="b">
<default>false</default>
</key>
<key name="library-rows" type="i">
<default>0</default>
</key>
</schema>
<schema id="@APP_ID@.State" path="@PREFIX@/State/">

View File

@@ -114,6 +114,21 @@ class CartridgesWindow(Adw.ApplicationWindow):
style_manager.connect("notify::dark", self.set_details_view_opacity)
style_manager.connect("notify::high-contrast", self.set_details_view_opacity)
# Allow for a custom number of rows for the library
if shared.schema.get_int("library-rows"):
shared.schema.bind(
"library-rows",
self.library,
"max-children-per-line",
Gio.SettingsBindFlags.DEFAULT,
)
shared.schema.bind(
"library-rows",
self.hidden_library,
"max-children-per-line",
Gio.SettingsBindFlags.DEFAULT,
)
def search_changed(self, _widget: Any, hidden: bool) -> None:
# Refresh search filter on keystroke in search box
(self.hidden_library if hidden else self.library).invalidate_filter()