Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

A project's Time Machine checkbox follows the rules for list rows

Țugui Dragoș65849750ade8
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 54c70a1c..4d0c04d6 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -206,12 +206,12 @@ read in one sitting.
uses in each. Write new or changed interface text in English, and run `python3 Scripts/sync_localizations.py`
after a Debug build so the catalog lists it. The translations are added before your change is merged; until
then `StringCatalogTests` fails for that text, and only for it. The `peel` tool and PeelCore stay in English.
-- **Rows of a long list stay cheap to build.** A list builds its rows as they scroll into view. A checkbox in a
- row is `NativeCheckbox` beside the item, with `checkboxTitleLine()` on the first line of its title and
+- **Rows of a long list stay cheap to build.** A list builds its rows as they scroll into view. A checkbox in a row
+ is `NativeCheckbox` beside the item, with `checkboxTitleLine()` on the first line of its title and
`checkboxTitle()` on the title, rather than a checkbox `Toggle` whose label is the row, since SwiftUI asks a
- `Toggle`'s button for its size each time the row is measured. A button in each row takes `RowButtonStyle`: one
- with a standard style changes the window's list of focusable views whenever a row scrolls in or out. A row a
- `ForEach` repeats never hides its own separator and is never a `Toggle` itself; the `ForEach` hides the
+ `Toggle`'s button for its size each time the row is measured. A button in each row takes `RowButtonStyle` or
+ `.borderless`: one of another style changes the window's list of focusable views whenever a row scrolls in or out.
+ A row a `ForEach` repeats never hides its own separator and is never a `Toggle` itself; the `ForEach` hides the
separators. A row that stands alone, such as a header or a notice, may hide its own, which costs nothing.
- **The interface follows Liquid Glass.** The sticker album look belongs to Home, the menu bar panel, and About
only; every other screen reads as macOS (system type, `Form` and `Section`, native controls). Icons are SF
diff --git a/Peel/Views/Projects/ProjectDetailView.swift b/Peel/Views/Projects/ProjectDetailView.swift
index cb3b8974..3461fe87 100644
--- a/Peel/Views/Projects/ProjectDetailView.swift
+++ b/Peel/Views/Projects/ProjectDetailView.swift
@@ -33,20 +33,9 @@ struct ProjectDetailView: View {
}
Section {
- Toggle(isOn: Binding(
- get: { projects.isExcludedFromBackups(group) },
- set: { projects.setExcludedFromBackups($0, in: group) }
- )) {
- VStack(alignment: .leading, spacing: 2) {
- Text("Leave these out of Time Machine")
- Text("Backups keep the project and skip the folders listed here, installed packages and .terraform included. A folder whose name could mean anything is still backed up. The mark sits on the folder itself: it moves with the folder, and a folder that a build deletes and makes again comes back without it.")
- .font(.caption)
- .foregroundStyle(.secondary)
- }
- }
- .toggleStyle(.checkbox)
- .disabled(!projects.canMarkForBackups(group))
- .listRowSeparator(.hidden)
+ backupsCheckbox
+ .disabled(!projects.canMarkForBackups(group))
+ .listRowSeparator(.hidden)
let failures = projects.backupMarkFailures(in: group)
if !failures.isEmpty {
Text("^[\(failures.count) folder](inflect: true) wouldn’t take the mark, usually because it belongs to another account.")
@@ -75,6 +64,30 @@ struct ProjectDetailView: View {
.toolbar(removing: .title)
}
+ /// A checkbox beside its words rather than a `Toggle` that is the row, as the list's other rows are.
+ private var backupsCheckbox: some View {
+ let isOn = Binding(
+ get: { projects.isExcludedFromBackups(group) },
+ set: { projects.setExcludedFromBackups($0, in: group) }
+ )
+ let explanation = String(localized: "Backups keep the project and skip the folders listed here, installed packages and .terraform included. A folder whose name could mean anything is still backed up. The mark sits on the folder itself: it moves with the folder, and a folder that a build deletes and makes again comes back without it.")
+ return HStack(alignment: .checkboxTitleLine, spacing: 5) {
+ NativeCheckbox(isOn: isOn, label: String(localized: "Leave these out of Time Machine"), hint: explanation)
+ VStack(alignment: .leading, spacing: 2) {
+ Text("Leave these out of Time Machine")
+ .checkboxTitleLine()
+ Text(verbatim: explanation)
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ }
+ .checkboxTitle()
+ .contentShape(.rect)
+ .onTapGesture { isOn.wrappedValue.toggle() }
+ // The checkbox's label already reads them.
+ .accessibilityHidden(true)
+ }
+ }
+
private var header: some View {
PageHeader(systemImage: "folder") {
Text(verbatim: group.project.lastPathComponent)