GUI: add back to dialog module results. Power: exit from reboot view. (#477)
Co-authored-by: SG <who.just.the.doctor@gmail.com>
This commit is contained in:
parent
93fbb2e182
commit
f1198950e9
@ -50,6 +50,9 @@ static bool dialog_view_input_callback(InputEvent* event, void* context) {
|
|||||||
} else if(event->key == InputKeyRight) {
|
} else if(event->key == InputKeyRight) {
|
||||||
dialog->callback(DialogResultRight, dialog->context);
|
dialog->callback(DialogResultRight, dialog->context);
|
||||||
consumed = true;
|
consumed = true;
|
||||||
|
} else if(event->key == InputKeyBack) {
|
||||||
|
dialog->callback(DialogResultBack, dialog->context);
|
||||||
|
consumed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ typedef struct Dialog Dialog;
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
DialogResultLeft,
|
DialogResultLeft,
|
||||||
DialogResultRight,
|
DialogResultRight,
|
||||||
|
DialogResultBack,
|
||||||
} DialogResult;
|
} DialogResult;
|
||||||
|
|
||||||
/* Dialog result callback type
|
/* Dialog result callback type
|
||||||
|
@ -60,13 +60,15 @@ void power_menu_reset_dialog_result(DialogResult result, void* context) {
|
|||||||
power_reset(power, PowerBootModeDfu);
|
power_reset(power, PowerBootModeDfu);
|
||||||
} else if(result == DialogResultRight) {
|
} else if(result == DialogResultRight) {
|
||||||
power_reset(power, PowerBootModeNormal);
|
power_reset(power, PowerBootModeNormal);
|
||||||
|
} else if(result == DialogResultBack) {
|
||||||
|
view_dispatcher_switch_to_view(power->view_dispatcher, VIEW_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void power_menu_reset_callback(void* context) {
|
void power_menu_reset_callback(void* context) {
|
||||||
Power* power = context;
|
Power* power = context;
|
||||||
dialog_set_result_callback(power->dialog, power_menu_reset_dialog_result);
|
dialog_set_result_callback(power->dialog, power_menu_reset_dialog_result);
|
||||||
dialog_set_header_text(power->dialog, "Reset type");
|
dialog_set_header_text(power->dialog, "Reboot type");
|
||||||
dialog_set_text(power->dialog, "Reboot where?");
|
dialog_set_text(power->dialog, "Reboot where?");
|
||||||
dialog_set_left_button_text(power->dialog, "DFU");
|
dialog_set_left_button_text(power->dialog, "DFU");
|
||||||
dialog_set_right_button_text(power->dialog, "OS");
|
dialog_set_right_button_text(power->dialog, "OS");
|
||||||
@ -98,7 +100,7 @@ Power* power_alloc() {
|
|||||||
menu_item_subitem_add(
|
menu_item_subitem_add(
|
||||||
power->menu, menu_item_alloc_function("Off", NULL, power_menu_off_callback, power));
|
power->menu, menu_item_alloc_function("Off", NULL, power_menu_off_callback, power));
|
||||||
menu_item_subitem_add(
|
menu_item_subitem_add(
|
||||||
power->menu, menu_item_alloc_function("Reset", NULL, power_menu_reset_callback, power));
|
power->menu, menu_item_alloc_function("Reboot", NULL, power_menu_reset_callback, power));
|
||||||
menu_item_subitem_add(
|
menu_item_subitem_add(
|
||||||
power->menu,
|
power->menu,
|
||||||
menu_item_alloc_function("Enable OTG", NULL, power_menu_enable_otg_callback, power));
|
menu_item_alloc_function("Enable OTG", NULL, power_menu_enable_otg_callback, power));
|
||||||
|
Loading…
Reference in New Issue
Block a user