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,8 +428,20 @@ impl Gvfs {
continue; continue;
} }
log::info!("unmount {}", name); if MountExt::can_eject(&mount) {
log::info!("eject {}", name);
MountExt::eject_with_operation( 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, &mount,
gio::MountUnmountFlags::NONE, gio::MountUnmountFlags::NONE,
gio::MountOperation::NONE, gio::MountOperation::NONE,
@ -442,6 +454,7 @@ impl Gvfs {
} }
} }
} }
}
}); });
main_loop.run() main_loop.run()
}); });