MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / onEjectPressed

Method onEjectPressed

Tactility/Source/app/files/View.cpp:437–450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

435}
436
437void View::onEjectPressed() {
438 std::string mount_path = state->getSelectedChildPath();
439 LOGGER.info("Ejecting {}", mount_path);
440
441 struct Device* msc_dev = device_find_first_active_by_type(&USB_HOST_MSC_TYPE);
442 if (!msc_dev || !usb_msc_eject(msc_dev, mount_path.c_str())) {
443 LOGGER.warn("usb_msc_eject: {} not found", mount_path);
444 alertdialog::start("Eject failed", "Could not eject \"" + file::getLastPathSegment(mount_path) + "\".");
445 }
446
447 onNavigate();
448 state->setEntriesForPath(state->getCurrentPath());
449 update();
450}
451
452void View::update(size_t start_index) {
453 const bool is_root = (state->getCurrentPath() == "/");

Callers 1

onEjectPressedCallbackFunction · 0.80

Calls 9

usb_msc_ejectFunction · 0.85
infoMethod · 0.80
warnMethod · 0.80
startFunction · 0.70
getLastPathSegmentFunction · 0.50
getSelectedChildPathMethod · 0.45
setEntriesForPathMethod · 0.45
getCurrentPathMethod · 0.45

Tested by

no test coverage detected