nyx: deduplicate window creation functions
Also rename mbox_action and fix a double lv obj deletion in partition manager.
This commit is contained in:
@@ -939,7 +939,7 @@ static lv_res_t _action_delete_linux_installer_files(lv_obj_t * btns, const char
|
||||
int btn_idx = lv_btnm_get_pressed(btns);
|
||||
|
||||
// Delete parent mbox.
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
|
||||
// Flash Linux.
|
||||
if (!btn_idx)
|
||||
@@ -990,7 +990,7 @@ static lv_res_t _action_flash_linux_data(lv_obj_t * btns, const char * txt)
|
||||
int btn_idx = lv_btnm_get_pressed(btns);
|
||||
|
||||
// Delete parent mbox.
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
|
||||
bool succeeded = false;
|
||||
|
||||
@@ -1182,7 +1182,7 @@ exit:
|
||||
}
|
||||
|
||||
if (!succeeded)
|
||||
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
|
||||
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
|
||||
else
|
||||
lv_mbox_add_btns(mbox, mbox_btn_map2, _action_delete_linux_installer_files);
|
||||
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
@@ -1385,7 +1385,7 @@ static lv_res_t _action_check_flash_linux(lv_obj_t *btn)
|
||||
goto exit;
|
||||
|
||||
error:
|
||||
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
|
||||
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
|
||||
|
||||
exit:
|
||||
boot_storage_unmount();
|
||||
@@ -1407,7 +1407,7 @@ static lv_res_t _action_reboot_recovery(lv_obj_t * btns, const char * txt)
|
||||
int btn_idx = lv_btnm_get_pressed(btns);
|
||||
|
||||
// Delete parent mbox.
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
|
||||
if (!btn_idx)
|
||||
{
|
||||
@@ -1444,7 +1444,7 @@ static lv_res_t _action_flash_android_data(lv_obj_t * btns, const char * txt)
|
||||
bool boot_recovery = false;
|
||||
|
||||
// Delete parent mbox.
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
|
||||
if (btn_idx)
|
||||
return LV_RES_INV;
|
||||
@@ -1706,7 +1706,7 @@ error:
|
||||
lv_mbox_add_btns(mbox, mbox_btn_map2, _action_reboot_recovery);
|
||||
}
|
||||
else
|
||||
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
|
||||
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
|
||||
|
||||
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
@@ -1880,7 +1880,7 @@ static lv_res_t _action_part_manager_flash_options0(lv_obj_t *btns, const char *
|
||||
_action_flash_android_slot_select(btns);
|
||||
break;
|
||||
case 3:
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
@@ -1902,11 +1902,11 @@ static lv_res_t _action_part_manager_flash_options1(lv_obj_t *btns, const char *
|
||||
lv_obj_del(ums_mbox);
|
||||
break;
|
||||
case 1:
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
_action_check_flash_linux(NULL);
|
||||
return LV_RES_INV;
|
||||
case 2:
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
@@ -1928,11 +1928,11 @@ static lv_res_t _action_part_manager_flash_options2(lv_obj_t *btns, const char *
|
||||
lv_obj_del(ums_mbox);
|
||||
break;
|
||||
case 1:
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
_action_flash_android_slot_select(NULL);
|
||||
return LV_RES_INV;
|
||||
case 2:
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
@@ -2458,9 +2458,8 @@ error:
|
||||
lv_obj_del(lbl_paths[1]);
|
||||
|
||||
exit:
|
||||
if(!buttons_set){
|
||||
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
|
||||
}
|
||||
if (!buttons_set)
|
||||
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
|
||||
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_set_top(mbox, true);
|
||||
|
||||
@@ -2662,7 +2661,7 @@ exit:
|
||||
free(txt_buf);
|
||||
|
||||
if (!buttons_set)
|
||||
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
|
||||
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
|
||||
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_set_top(mbox, true);
|
||||
|
||||
@@ -2687,11 +2686,11 @@ static lv_res_t _create_mbox_partitioning_option0(lv_obj_t *btns, const char *tx
|
||||
}
|
||||
return LV_RES_OK;
|
||||
case 1:
|
||||
mbox_action(btns, txt);
|
||||
_create_mbox_start_partitioning();
|
||||
nyx_mbox_action(btns, txt);
|
||||
_sd_create_mbox_start_partitioning();
|
||||
break;
|
||||
case 2:
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2702,11 +2701,10 @@ static lv_res_t _create_mbox_partitioning_option1(lv_obj_t *btns, const char *tx
|
||||
{
|
||||
int btn_idx = lv_btnm_get_pressed(btns);
|
||||
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
|
||||
if (!btn_idx)
|
||||
{
|
||||
mbox_action(btns, txt);
|
||||
if (!part_info.emmc)
|
||||
_create_mbox_start_partitioning();
|
||||
else
|
||||
@@ -2761,7 +2759,7 @@ static lv_res_t _create_mbox_partitioning_warn()
|
||||
lv_label_set_text(lbl_status, txt_buf);
|
||||
|
||||
if (part_info.backup_possible)
|
||||
lv_mbox_add_btns(mbox, mbox_btn_map2, _create_mbox_partitioning_option1);
|
||||
lv_mbox_add_btns(mbox, mbox_btn_map1, _create_mbox_partitioning_option1);
|
||||
else
|
||||
lv_mbox_add_btns(mbox, mbox_btn_map, _create_mbox_partitioning_option0);
|
||||
}
|
||||
@@ -2811,7 +2809,7 @@ static lv_res_t _create_mbox_partitioning_android(lv_obj_t *btns, const char *tx
|
||||
{
|
||||
int btn_idx = lv_btnm_get_pressed(btns);
|
||||
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
|
||||
part_info.and_dynamic = !btn_idx;
|
||||
_create_mbox_partitioning_warn();
|
||||
@@ -3313,7 +3311,7 @@ static lv_res_t _mbox_check_files_total_size_option(lv_obj_t *btns, const char *
|
||||
if (!lv_btnm_get_pressed(btns))
|
||||
part_info.backup_possible = false;
|
||||
|
||||
mbox_action(btns, txt);
|
||||
nyx_mbox_action(btns, txt);
|
||||
|
||||
return LV_RES_INV;
|
||||
}
|
||||
@@ -3707,7 +3705,7 @@ static void _create_mbox_check_files_total_size(u8 drive)
|
||||
|
||||
|
||||
if (!part_info.backup_possible)
|
||||
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
|
||||
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
|
||||
else
|
||||
lv_mbox_add_btns(mbox, mbox_btn_map2, _mbox_check_files_total_size_option);
|
||||
|
||||
@@ -4042,7 +4040,7 @@ check_changes:
|
||||
out:
|
||||
free(gpt);
|
||||
|
||||
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
|
||||
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
|
||||
|
||||
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_set_top(mbox, true);
|
||||
|
||||
Reference in New Issue
Block a user