diff --git a/cartridges/importer/flatpak_source.py b/cartridges/importer/flatpak_source.py
index 97e2fe5..24ac57c 100644
--- a/cartridges/importer/flatpak_source.py
+++ b/cartridges/importer/flatpak_source.py
@@ -17,6 +17,7 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
+from itertools import chain
from pathlib import Path
from typing import NamedTuple
@@ -35,7 +36,8 @@ class FlatpakSourceIterable(SourceIterable):
"""Generator method producing games"""
icon_theme = Gtk.IconTheme.new()
- icon_theme.add_search_path(str(self.source.locations.data["icons"]))
+ icon_theme.add_search_path(str(self.source.locations.system_data["icons"]))
+ icon_theme.add_search_path(str(self.source.locations.user_data["icons"]))
blacklist = (
{"hu.kramo.Cartridges", "hu.kramo.Cartridges.Devel"}
@@ -52,7 +54,10 @@ class FlatpakSourceIterable(SourceIterable):
}
)
- for entry in (self.source.locations.data["applications"]).iterdir():
+ for entry in chain(
+ (self.source.locations.system_data["applications"]).iterdir(),
+ (self.source.locations.user_data["applications"]).iterdir(),
+ ):
if entry.suffix != ".desktop":
continue
@@ -108,7 +113,8 @@ class FlatpakSourceIterable(SourceIterable):
class FlatpakLocations(NamedTuple):
- data: Location
+ system_data: Location
+ user_data: Location
class FlatpakSource(ExecutableFormatSource):
@@ -126,15 +132,21 @@ class FlatpakSource(ExecutableFormatSource):
super().__init__()
self.locations = FlatpakLocations(
Location(
- schema_key="flatpak-location",
- candidates=(
- "/var/lib/flatpak/",
- shared.data_dir / "flatpak",
- ),
+ schema_key="flatpak-system-location",
+ candidates=("/var/lib/flatpak/",),
paths={
"applications": LocationSubPath("exports/share/applications", True),
"icons": LocationSubPath("exports/share/icons", True),
},
invalid_subtitle=Location.DATA_INVALID_SUBTITLE,
- )
+ ),
+ Location(
+ schema_key="flatpak-user-location",
+ candidates=(shared.data_dir / "flatpak",),
+ paths={
+ "applications": LocationSubPath("exports/share/applications", True),
+ "icons": LocationSubPath("exports/share/icons", True),
+ },
+ invalid_subtitle=Location.DATA_INVALID_SUBTITLE,
+ ),
)
diff --git a/cartridges/preferences.py b/cartridges/preferences.py
index 71390d5..98fc7fc 100644
--- a/cartridges/preferences.py
+++ b/cartridges/preferences.py
@@ -95,8 +95,10 @@ class PreferencesWindow(Adw.PreferencesWindow):
retroarch_config_file_chooser_button = Gtk.Template.Child()
flatpak_expander_row = Gtk.Template.Child()
- flatpak_data_action_row = Gtk.Template.Child()
- flatpak_data_file_chooser_button = Gtk.Template.Child()
+ flatpak_system_data_action_row = Gtk.Template.Child()
+ flatpak_system_data_file_chooser_button = Gtk.Template.Child()
+ flatpak_user_data_action_row = Gtk.Template.Child()
+ flatpak_user_data_file_chooser_button = Gtk.Template.Child()
flatpak_import_launchers_switch = Gtk.Template.Child()
desktop_switch = Gtk.Template.Child()
diff --git a/data/gtk/preferences.blp b/data/gtk/preferences.blp
index e1a1dba..5501d72 100644
--- a/data/gtk/preferences.blp
+++ b/data/gtk/preferences.blp
@@ -322,10 +322,22 @@ template $PreferencesWindow : Adw.PreferencesWindow {
icon-name: "flatpak-source-symbolic";
}
- Adw.ActionRow flatpak_data_action_row {
- title: _("Install Location");
+ Adw.ActionRow flatpak_system_data_action_row {
+ title: _("System Location");
- Button flatpak_data_file_chooser_button {
+ Button flatpak_system_data_file_chooser_button {
+ icon-name: "folder-symbolic";
+ valign: center;
+ styles [
+ "flat"
+ ]
+ }
+ }
+
+ Adw.ActionRow flatpak_user_data_action_row {
+ title: _("User Location");
+
+ Button flatpak_user_data_file_chooser_button {
icon-name: "folder-symbolic";
valign: center;
styles [
diff --git a/data/hu.kramo.Cartridges.gschema.xml.in b/data/hu.kramo.Cartridges.gschema.xml.in
index 8480e57..c8497e4 100644
--- a/data/hu.kramo.Cartridges.gschema.xml.in
+++ b/data/hu.kramo.Cartridges.gschema.xml.in
@@ -83,9 +83,12 @@
true
-
+
"/var/lib/flatpak/"
+
+ "~/.local/share/flatpak/"
+
false
diff --git a/flatpak/hu.kramo.Cartridges.Devel.json b/flatpak/hu.kramo.Cartridges.Devel.json
index 7a74b30..e9787f4 100644
--- a/flatpak/hu.kramo.Cartridges.Devel.json
+++ b/flatpak/hu.kramo.Cartridges.Devel.json
@@ -19,7 +19,10 @@
"--filesystem=~/.var/app/com.usebottles.bottles/data/bottles/:ro",
"--filesystem=~/.var/app/io.itch.itch/config/itch/:ro",
"--filesystem=~/.var/app/org.libretro.RetroArch/config/retroarch/:ro",
- "--filesystem=/var/lib/flatpak:ro"
+ "--filesystem=/var/lib/flatpak/app:ro",
+ "--filesystem=/var/lib/flatpak/exports:ro",
+ "--filesystem=xdg-data/flatpak/app:ro",
+ "--filesystem=xdg-data/flatpak/exports:ro"
],
"cleanup" : [
"/include",