diff options
author | quentin konieczko <konieczko@gmail.com> | 2023-01-27 10:45:45 +0100 |
---|---|---|
committer | quentin konieczko <konieczko@gmail.com> | 2023-01-27 10:45:45 +0100 |
commit | 432e097fa8c27f66161f09a66cf189b883de0ae5 (patch) | |
tree | 0d86ca7c62264a2dce541f069f7c34b29f347d2c /src | |
parent | 3ffd96e718d2ca11c2a48b273e22984a1de2e33f (diff) |
encrypted device: g move to the selected mount point
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptsetup.rs | 2 | ||||
-rw-r--r-- | src/event_dispatch.rs | 3 | ||||
-rw-r--r-- | src/event_exec.rs | 14 |
3 files changed, 18 insertions, 1 deletions
diff --git a/src/cryptsetup.rs b/src/cryptsetup.rs index 2c306ed..e851eb6 100644 --- a/src/cryptsetup.rs +++ b/src/cryptsetup.rs @@ -246,7 +246,7 @@ impl CryptoDevice { ] } - fn mount_point(&self) -> Option<String> { + pub fn mount_point(&self) -> Option<String> { let system_info = System::new_all(); system_info .disks() diff --git a/src/event_dispatch.rs b/src/event_dispatch.rs index 5321254..722cb8f 100644 --- a/src/event_dispatch.rs +++ b/src/event_dispatch.rs @@ -99,6 +99,9 @@ impl EventDispatcher { Mode::Navigate(Navigate::EncryptedDrive) if c == 'm' => { EventExec::event_mount_encrypted_drive(status) } + Mode::Navigate(Navigate::EncryptedDrive) if c == 'g' => { + EventExec::event_move_to_encrypted_drive(status) + } Mode::Navigate(Navigate::EncryptedDrive) if c == 'u' => { EventExec::event_umount_encrypted_drive(status) } diff --git a/src/event_exec.rs b/src/event_exec.rs index 0c70508..bc7b0db 100644 --- a/src/event_exec.rs +++ b/src/event_exec.rs @@ -1589,6 +1589,20 @@ impl EventExec { } } + /// Move to the selected crypted device mount point. + pub fn event_move_to_encrypted_drive(status: &mut Status) -> FmResult<()> { + if let Some(device) = status.encrypted_devices.selected() { + if let Some(mount_point) = device.cryptdevice.mount_point() { + let tab = status.selected(); + let path = path::PathBuf::from(mount_point); + tab.history.push(&path); + tab.set_pathcontent(&path)?; + Self::event_normal(tab)? + } + } + Ok(()) + } + /// Unmount the selected device. /// Will ask first for a sudo password which is immediatly forgotten. pub fn event_umount_encrypted_drive(status: &mut Status) -> FmResult<()> { |