Fall back to unmount if eject is not supported, fixes #941

This commit is contained in:
Jeremy Soller 2025-04-21 13:21:02 -06:00
parent 08f0cab550
commit 7598130650
No known key found for this signature in database
GPG key ID: 670FDFB5428E05CA

View file

@ -428,16 +428,29 @@ impl Gvfs {
continue;
}
log::info!("unmount {}", name);
MountExt::eject_with_operation(
&mount,
gio::MountUnmountFlags::NONE,
gio::MountOperation::NONE,
gio::Cancellable::NONE,
move |result| {
log::info!("unmount {}: result {:?}", name, result);
},
);
if MountExt::can_eject(&mount) {
log::info!("eject {}", name);
MountExt::eject_with_operation(
&mount,
gio::MountUnmountFlags::NONE,
gio::MountOperation::NONE,
gio::Cancellable::NONE,
move |result| {
log::info!("eject {}: result {:?}", name, result);
},
);
} else {
log::info!("unmount {}", name);
MountExt::unmount_with_operation(
&mount,
gio::MountUnmountFlags::NONE,
gio::MountOperation::NONE,
gio::Cancellable::NONE,
move |result| {
log::info!("unmount {}: result {:?}", name, result);
},
);
}
}
}
}