Skip to content

GTK4: perry_ui_open_folder_dialog not wired — blocks docs/examples/ui/dialogs/snippets.ts on Linux CI #216

Description

@proggeramlug

Context

docs/examples/ui/dialogs/snippets.ts declares // platforms: macos, linux, windows and imports openFolderDialog from perry/ui to demonstrate the folder-picker pattern. The example compiles + links cleanly on macOS but fails on the GTK4-on-Ubuntu doc-tests CI runner with:

/usr/bin/ld: perry_llvm_*.ll:(.text+...): undefined reference to `perry_ui_open_folder_dialog'

Origin/main is currently red on the gtk4 doc-tests gate because of this and two layout FFIs (filed separately).

What's missing

FFI macOS GTK4
perry_ui_open_folder_dialog ✅ wired (NSOpenPanel with canChooseDirectories: YES, canChooseFiles: NO) ❌ missing

Recommended GTK4 implementation

gtk::FileChooserDialog with Action::SelectFolder is the direct mapping. Mirror the existing GTK4 file-picker pattern (search crates/perry-ui-gtk4/src/ for FileChooserNative / FileChooserDialog) — fold this in by changing the action to SelectFolder and removing the file-filter setup. The TS callback signature is (path: string) => void; on cancel pass an empty string to match the macOS implementation's contract.

Acceptance

  • perry_ui_open_folder_dialog exported as #[no_mangle] pub extern "C" fn in crates/perry-ui-gtk4/src/lib.rs.
  • If a styling-matrix row applies to this FFI (it might not — folder dialog is more "system" than "styling"), flip the GTK4 cell from Missing to Wired.
  • cargo build --release -p perry-ui-gtk4 succeeds.
  • After re-running the doc-tests harness, docs/examples/ui/dialogs/snippets.ts compiles + links cleanly on Linux. Verify by inspecting the linker output (the example's runtime test mode exits before opening any modal, so PERRY_UI_TEST_MODE=1 is sufficient).
  • No regression on the macOS doc-tests gate.

Pointers

  • macOS implementation: search crates/perry-ui-macos/src/ for perry_ui_open_folder_dialog.
  • GTK4 file-picker reference (closest existing analogue): search crates/perry-ui-gtk4/src/ for whatever already wires openFileDialog / saveFileDialog. Add the SelectFolder variant alongside.
  • Failing doc-test: docs/examples/ui/dialogs/snippets.ts (banner declares all 3 platforms; line invokes openFolderDialog).

Related

Estimated size

Small — ~30-50 LOC including the GTK4 FFI wrapper, the FFI export in lib.rs, and possibly an entry in the styling matrix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew capability or improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions