Skip to main content

Module places

Module places 

Source
Expand description

The system’s places the in-app picker lists beside home: its folders (Desktop, Documents, Downloads, Pictures, Music, Videos) and the volumes mounted, removable cards among them, the first place of a photo import.

system_places reads them from the system: on Linux and the BSDs the XDG user directories (user-dirs.dirs) and the mount points under /run/media/<user>, /media and /mnt; on macOS the folders in home and /Volumes; on Windows the folders in the user’s profile and the drives. They are read when a picker opens, not each frame. An application gives its own with Files::set_system_places (a demo, a sandbox, tests).

Beside them, an application adds sections of its own (a photo import’s cards, services and history): a PlaceProvider registered on the files service (Files::place_providers, FilesPlugin::places) gives PlaceSections of PlaceItems. The in-app picker lists them under its own places, and a PlacesPanel draws all of them anywhere (an import window’s sources column). An item is a name, an icon, a detail, a badge and, for a folder, its path; egui-pop knows nothing more of it: an item without a path (an account of a service) is the application’s to act on.

A panel goes further than the picker’s list, each part opt-in: a section that folds (PlaceSection::foldable), says what it lacks (PlaceSection::empty) or has no heading (PlaceSection::untitled); an item with a line shown under its name (PlaceItem::line), a badge in a tone (PlaceItem::badge_tone) and a toggle of the application’s (a pin, PlaceToggle); and room under an item or a section for the application’s own content (PlacesPanel::under_item, PlacesPanel::under_section). What the user did comes back in PlacesOutput: the application keeps the state and acts.

Structs§

PlaceBadgeIcon
A state badge on a PlaceItem’s icon (PlaceItem::badge_icon).
PlaceImage
The image of a PlaceItem (PlaceItem::image): an egui image source, two of them equal when egui would load them as one (the same URI, or the same texture at the same size).
PlaceItem
One place of a PlaceSection: a folder, a volume, or an application’s own (a card, an account of a service). Made with PlaceItem::new or PlaceItem::folder and its builders.
PlaceProviders
The place providers declared, as a service of Files.
PlaceSection
A titled list of places: the system’s folders, the devices, or an application’s (“Cards”, “Services”); or an untitled one, its rows shown without a heading (PlaceSection::untitled).
PlaceSegment
A segment of a PlaceItem’s compacted name (PlaceItem::segments): what it shows, the application’s id for it, and what a screen reader says of it.
PlaceSegmentClick
A click on one segment of an item’s compacted name (PlacesOutput::segment).
PlaceToggle
A toggle at the end of a PlaceItem (a pin for the favourites): an icon on or off, named for assistive technology. The application owns its state: a click is reported (PlacesOutput::toggled), and the application gives the item again with the new state.
PlacesOutput
What a PlacesPanel did this frame.
PlacesPanel
A side panel of places: sections, each a heading over its items, as the in-app picker lists them (an import window’s sources column). One stop for Tab; Up and Down go from item to item across the sections (through an item’s toggle, a fold’s band and the application’s content, in the order drawn), Enter or Space chooses. Each item is a button named by its name and badge, described by its line, selected or not; each title a heading, or a fold’s band when the section folds. What a chosen item does is the caller’s: PlacesOutput::chosen.
SystemPlaces
The system’s places, as the picker lists them.
Volume
A volume mounted: its name and where it is.

Enums§

IndentGuides
When a hand-built tree draws its indent guides: a thin line down each nesting level, as VS Code’s explorer does (renderIndentGuides). Never by default, so that a tree looks as it always did.
SystemFolder
A folder of the system’s, by what it is for.

Constants§

SEGMENT_SEPARATOR
The separator egui-pop draws between a PlaceItem’s segments.

Traits§

PlaceProvider
An application’s sections of places (PlaceProviders::register). Asked each time a picker or a panel is drawn: it answers from what it holds (a device watch’s list, a history kept in memory), never reading a disk or a network there.

Functions§

system_places
The system’s places, read from the system (see the module).
xdg_user_dirs
The folders user-dirs.dirs names (XDG_PICTURES_DIR="$HOME/Pictures"), in the picker’s order; one set to home itself means none, as the specification says. Whether they exist is not checked.