diff --git a/data/gtk/preferences.blp b/data/gtk/preferences.blp index eacd33c..98c4341 100644 --- a/data/gtk/preferences.blp +++ b/data/gtk/preferences.blp @@ -216,6 +216,20 @@ template $PreferencesWindow : Adw.PreferencesWindow { } } } + + Adw.ExpanderRow flatpak_expander_row { + title: _("Flatpak Games"); + show-enable-switch: true; + + Adw.ActionRow flatpak_data_action_row { + title: _("Install Location"); + + Button flatpak_config_file_chooser_button { + icon-name: "folder-symbolic"; + valign: center; + } + } + } } } diff --git a/src/importer/sources/flatpak_source.py b/src/importer/sources/flatpak_source.py index 4117cae..fa6567a 100644 --- a/src/importer/sources/flatpak_source.py +++ b/src/importer/sources/flatpak_source.py @@ -46,7 +46,7 @@ class FlatpakSourceIterator(SourceIterator): with entry.open("r", encoding="utf-8") as open_file: string = open_file.read() - desktop_values = {"Name": None, "Icon": None} + desktop_values = {"Name": None, "Icon": None, "Categories": None} for key in desktop_values: if regex := re.findall(f"{key}=(.*)\n", string): desktop_values[key] = regex[0] @@ -54,6 +54,12 @@ class FlatpakSourceIterator(SourceIterator): if not desktop_values["Name"]: continue + if not desktop_values["Categories"]: + continue + + if not "Game" in desktop_values["Categories"].split(";"): + continue + values = { "source": self.source.id, "added": added_time, @@ -67,8 +73,10 @@ class FlatpakSourceIterator(SourceIterator): additional_data = {} if icon_name := desktop_values["Icon"]: - if icon_path := IconTheme.getIconPath(icon_name): + if icon_path := IconTheme.getIconPath(icon_name, 512): additional_data = {"local_image_path": Path(icon_path)} + else: + print(":(") # Produce game yield (game, additional_data) diff --git a/src/main.py b/src/main.py index 6ef9089..9d5851e 100644 --- a/src/main.py +++ b/src/main.py @@ -223,7 +223,7 @@ class CartridgesApplication(Adw.Application): if shared.schema.get_boolean("bottles"): importer.add_source(BottlesSource()) - if not shared.schema.get_boolean("flatpak"): + if shared.schema.get_boolean("flatpak"): importer.add_source(FlatpakSource()) if shared.schema.get_boolean("itch"): diff --git a/src/preferences.py b/src/preferences.py index 04a8ff8..7a807d6 100644 --- a/src/preferences.py +++ b/src/preferences.py @@ -80,6 +80,10 @@ class PreferencesWindow(Adw.PreferencesWindow): legendary_config_action_row = Gtk.Template.Child() legendary_config_file_chooser_button = Gtk.Template.Child() + flatpak_expander_row = Gtk.Template.Child() + flatpak_data_action_row = Gtk.Template.Child() + flatpak_config_file_chooser_button = Gtk.Template.Child() + sgdb_key_group = Gtk.Template.Child() sgdb_key_entry_row = Gtk.Template.Child() sgdb_switch = Gtk.Template.Child()