Repository navigation
List drives that aren't mounted yet, and mount them on a click or as they're plugged in - #22
AyushKr2003 wants to merge 11 commits into
Conversation
[Medium impact] The PR appears safe to merge with two non-blocking edge cases around stalled reads and mount cleanup. FindingsSummaryThis PR adds unmounted drives to Devices, mounts them when opened or plugged in, and reuses the existing drive-release flow.
Two non-blocking edge cases remain: stalled filesystem reads delay new drive rows, and closing a window can leave a stalled mount request running.
|
317340a to
c256d8e
Compare
Devices listed only what was already mounted, so another system's partitions and a stick that nothing had mounted never showed. It now lists GIO's volumes, as Nautilus does: udisks leaves out the system's own and hidden partitions (EFI, recovery), and the list follows plugging, mounting and unmounting at once instead of on the 15-second poll. - A click on one that isn't mounted mounts it and opens it. udisks asks the session's polkit agent where it needs permission, and an encrypted drive's passphrase is asked for in the window, kept for no session. - A drive plugged in that udisks marks to mount by itself is mounted, unless GNOME's automount setting is off. A desktop automounter (udiskie, a shell) gets two seconds' head start, so nothing is mounted, or asked for its passphrase, twice. - A mounted drive has an eject button: removable ones are ejected, others unmounted. Panes in a drive that goes away, from here or elsewhere, go home first. - An encrypted drive that unlocks with nothing mountable inside says so, instead of nothing happening.
A wrong passphrase and a retry left the first reply's timer running, so it could cancel the corrected attempt early. A new request now stops the last reply's timer, and each reply starts its own.
An encrypted drive that unlocked but was slow to mount its filesystem still read as "nothing on it that can be mounted" once the minute ran out. Now that's said only when nothing inside the unlocked device is a filesystem, by udev's record of it; otherwise it's reported as timed out.
487ecd6 to
cf6773f
Compare
Main now lets go of mounted drives itself (Places::eject and leave, the drive menu and its eject button), so the branch keeps only what main lacks: GIO's unmounted volumes in Devices, mounting one with its passphrase put in the window, and mounting a drive as it's plugged in. A drive's questions go to the user, as an unverified server's do, and an unmount from anywhere is left through Places::leave.
|
I built much the same thing locally before finding this, so I'll leave drives to this PR. Two things from mine that might be worth folding in:
|
# Conflicts: # src/main.cpp
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
# Conflicts: # src/Sidebar.qml # src/i18n/en.json
| } | ||
| const QVariantList devices = physicalDrives(mounts, m_systemDevice); | ||
| const QVariantList physical = physicalDrives(mounts, m_systemDevice); | ||
| const QVariantList devices = m_drives ? devicesFrom(m_drives->volumes(), physical, mounts) : physical; |
There was a problem hiding this comment.
Stalled reads hide new drives. The new GIO rows are published only from
mountsRead(). If an existing NFS mount stops answering during readMounts(), every drive event returns from refreshDevices() without updating Devices. Even an unmounted drive, which needs no filesystem read, stays missing until that unrelated read finishes.
Update the GIO rows from the last completed mount data while a new read runs, then fill in free space when it finishes.
Knowledge Base Used: Storage discovery and mounts
| if (m_cancellable) { | ||
| g_object_unref(m_cancellable); | ||
| m_cancellable = nullptr; |
There was a problem hiding this comment.
Closed windows leave mounts running. After a passphrase is submitted,
m_asking is false. Closing that window makes the destructor’s cancel() return without stopping the mount. This new cleanup code only drops the reference to m_cancellable; it does not cancel the request. The window’s destruction also removes the minute-long timer.
For the supported case where an unlocked drive has nothing mountable inside, the request can therefore remain pending indefinitely. Cancel the active m_cancellable during teardown before dropping it.
Knowledge Base Used: Mounting workflow
Devices lists only drives that are already mounted. On a machine that also has Windows and another Linux install, none of those partitions show until they're mounted by hand, while Nautilus lists them all and mounts one on a click.
Letting go of a drive is now
main's own (Places::ejectandleave, the eject button and the drive menu, from #32 and #53), so this branch is merged withmainand builds on that rather than adding a second way to eject.What changes
Acer(Windows),53 GB Volume,ryoku(another Arch). A mounted volume is the rowphysicalDrivesalready makes for it (free space, Eject or Unmount), with its volume id added; mounted drives GIO doesn't know (an fstab mount under/mnt) follow, as before, and a mounted volumephysicalDrivesleaves out (the system's own) stays out. The list follows plugging, mounting and unmounting at once viaGVolumeMonitor, instead of waiting for the 15-second poll.g_volume_mount), and so do ⏎ and the drive menu's Mount. udisks asks the session's polkit agent where it needs permission. An encrypted drive's passphrase is asked for in the window through the mount prompt, which then reads "Unlock" and shows only a Passphrase field. The passphrase isn't saved. A drive's questions go to the user, as an unverified server's do.org.gnome.desktop.media-handling automountwhen that schema is installed. A desktop automounter (udiskie, a shell) gets two seconds' head start, so a drive isn't mounted twice and an encrypted one isn't asked for its passphrase twice. The mount goes through the last window used, so it can ask for a passphrase. "TESTSTICK is mounted" shows as a notice.Places::leave, so panes go home and previews close, as they do formain's own eject.The GIO code lives in a new
Drivesclass (drives.h/.cpp).MountergainsmountVolume()alongsidemount(), sharing its prompt, andPlaces::devicesFromputs the two lists together. Unmounted rows have nopathand norelease, so the eject button and Format stay away from them.Tested
main.bin/test: 194 passed, including the reworkedplacesListDrivesNotMountedYetandenglishCatalogMatchesTheSources(the new strings are inen.json). The one failure,previewerPicksAViewerForEachType(CR2 →image), depends on the Qt image plugins installed here and fails the same way onmain./run/media/<user>/ryokuthrough the polkit agent and opened it. Unmounting it from a terminal (gio mount -u) sent the pane home.udisksctl loop-setup(udiskie paused) was mounted by Folio after the delay, with the notice. With udiskie running, udiskie mounted it and Folio left it alone.