Style import preferences rows better
This commit is contained in:
@@ -21,6 +21,7 @@ import logging
|
|||||||
import re
|
import re
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
|
from sys import platform
|
||||||
from typing import Any, Callable, Optional
|
from typing import Any, Callable, Optional
|
||||||
|
|
||||||
from gi.repository import Adw, Gio, GLib, Gtk
|
from gi.repository import Adw, Gio, GLib, Gtk
|
||||||
@@ -330,9 +331,16 @@ class CartridgesPreferences(Adw.PreferencesDialog):
|
|||||||
)
|
)
|
||||||
if not action_row:
|
if not action_row:
|
||||||
continue
|
continue
|
||||||
path = Path(shared.schema.get_string(location.schema_key)).expanduser()
|
|
||||||
# Remove the path prefix if picked via Flatpak portal
|
subtitle = str(Path(shared.schema.get_string(location.schema_key)))
|
||||||
subtitle = re.sub("/run/user/\\d*/doc/.*/", "", str(path))
|
|
||||||
|
if platform == "linux":
|
||||||
|
# Remove the path prefix if picked via Flatpak portal
|
||||||
|
subtitle = re.sub("/run/user/\\d*/doc/.*/", "", subtitle)
|
||||||
|
|
||||||
|
# Replace the home directory with "~"
|
||||||
|
subtitle = re.sub(f"^{str(shared.home)}", "~", subtitle)
|
||||||
|
|
||||||
action_row.set_subtitle(subtitle)
|
action_row.set_subtitle(subtitle)
|
||||||
|
|
||||||
def resolve_locations(self, source: Source) -> None:
|
def resolve_locations(self, source: Source) -> None:
|
||||||
|
|||||||
@@ -144,6 +144,10 @@ template $CartridgesPreferences: Adw.PreferencesDialog {
|
|||||||
"flat"
|
"flat"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
styles [
|
||||||
|
"property"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,6 +171,10 @@ template $CartridgesPreferences: Adw.PreferencesDialog {
|
|||||||
"flat"
|
"flat"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
styles [
|
||||||
|
"property"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
Adw.SwitchRow lutris_import_steam_switch {
|
Adw.SwitchRow lutris_import_steam_switch {
|
||||||
@@ -198,6 +206,10 @@ template $CartridgesPreferences: Adw.PreferencesDialog {
|
|||||||
"flat"
|
"flat"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
styles [
|
||||||
|
"property"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
Adw.SwitchRow heroic_import_epic_switch {
|
Adw.SwitchRow heroic_import_epic_switch {
|
||||||
@@ -237,6 +249,10 @@ template $CartridgesPreferences: Adw.PreferencesDialog {
|
|||||||
"flat"
|
"flat"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
styles [
|
||||||
|
"property"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,6 +276,10 @@ template $CartridgesPreferences: Adw.PreferencesDialog {
|
|||||||
"flat"
|
"flat"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
styles [
|
||||||
|
"property"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,6 +303,10 @@ template $CartridgesPreferences: Adw.PreferencesDialog {
|
|||||||
"flat"
|
"flat"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
styles [
|
||||||
|
"property"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,6 +330,10 @@ template $CartridgesPreferences: Adw.PreferencesDialog {
|
|||||||
"flat"
|
"flat"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
styles [
|
||||||
|
"property"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,6 +358,10 @@ template $CartridgesPreferences: Adw.PreferencesDialog {
|
|||||||
"flat"
|
"flat"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
styles [
|
||||||
|
"property"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
Adw.ActionRow flatpak_user_data_action_row {
|
Adw.ActionRow flatpak_user_data_action_row {
|
||||||
@@ -344,6 +376,10 @@ template $CartridgesPreferences: Adw.PreferencesDialog {
|
|||||||
"flat"
|
"flat"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
styles [
|
||||||
|
"property"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
Adw.SwitchRow flatpak_import_launchers_switch {
|
Adw.SwitchRow flatpak_import_launchers_switch {
|
||||||
|
|||||||
Reference in New Issue
Block a user