void
nan_backup_menu(int pIdx)
{
	tw_total = 0;
	char* nan_b_headers[] = { "Nandroid Backup",
							   "Choose Backup Options:",
							   NULL	};
	
	char* nan_b_items[] = { "--> Backup Naowz!",
							 nan_img_set(ITEM_NAN_SYSTEM,0),
							 nan_img_set(ITEM_NAN_DATA,0),
							 nan_img_set(ITEM_NAN_BOOT,0),
							 nan_img_set(ITEM_NAN_RECOVERY,0),
							 nan_img_set(ITEM_NAN_CACHE,0),
							 nan_img_set(ITEM_NAN_WIMAX,0),
							 nan_img_set(ITEM_NAN_ANDSEC,0),
							 nan_img_set(ITEM_NAN_SDEXT,0),
							 nan_compress(),
							 "<-- Back To Nandroid Menu",
							 NULL };

	char** headers = prepend_title(nan_b_headers);
	
    inc_menu_loc(ITEM_NAN_BACK);
	for (;;) {
		int chosen_item = get_menu_selection(headers, nan_b_items, 0, pIdx); // get key presses
		pIdx = chosen_item; // remember last selection location
		switch (chosen_item) {
			case ITEM_NAN_BACKUP:
				if (tw_total > 0) {
					nandroid_back_exe();
					dec_menu_loc();
					return;
				}
				break;
			case ITEM_NAN_SYSTEM:
            	if (DataManager_GetIntValue(TW_NANDROID_SYSTEM_VAR)) {
            		DataManager_SetIntValue(TW_NANDROID_SYSTEM_VAR, 0); // toggle's value
            		tw_total--; // keeps count of how many selected
            	} else {
            		DataManager_SetIntValue(TW_NANDROID_SYSTEM_VAR, 1);
            		tw_total++;
            	}
                break;
			case ITEM_NAN_DATA:
            	if (DataManager_GetIntValue(TW_NANDROID_DATA_VAR)) {
            		DataManager_SetIntValue(TW_NANDROID_DATA_VAR, 0);
            		tw_total--;
            	} else {
            		DataManager_SetIntValue(TW_NANDROID_DATA_VAR, 1);
            		tw_total++;
            	}
				break;
			case ITEM_NAN_BOOT:
            	if (DataManager_GetIntValue(TW_NANDROID_BOOT_VAR)) {
            		DataManager_SetIntValue(TW_NANDROID_BOOT_VAR, 0);
            		tw_total--;
            	} else {
            		DataManager_SetIntValue(TW_NANDROID_BOOT_VAR, 1);
            		tw_total++;
            	}
				break;
			case ITEM_NAN_RECOVERY:
            	if (DataManager_GetIntValue(TW_NANDROID_RECOVERY_VAR)) {
            		DataManager_SetIntValue(TW_NANDROID_RECOVERY_VAR, 0);
            		tw_total--;
            	} else {
            		DataManager_SetIntValue(TW_NANDROID_RECOVERY_VAR, 1);
            		tw_total++;
            	}
				break;
			case ITEM_NAN_CACHE:
            	if (DataManager_GetIntValue(TW_NANDROID_CACHE_VAR)) {
            		DataManager_SetIntValue(TW_NANDROID_CACHE_VAR, 0);
            		tw_total--;
            	} else {
            		DataManager_SetIntValue(TW_NANDROID_CACHE_VAR, 1);
            		tw_total++;
            	}
				break;
			case ITEM_NAN_WIMAX:
				if (tw_nan_wimax_x != -1) {
	            	if (DataManager_GetIntValue(TW_NANDROID_WIMAX_VAR)) {
	            		DataManager_SetIntValue(TW_NANDROID_WIMAX_VAR, 0);
	            		tw_total--;
	            	} else {
	            		DataManager_SetIntValue(TW_NANDROID_WIMAX_VAR, 1);
	            		tw_total++;
	            	}
				}
				break;
			case ITEM_NAN_ANDSEC:
				if (tw_nan_andsec_x != -1) {
	            	if (DataManager_GetIntValue(TW_NANDROID_ANDSEC_VAR)) {
	            		DataManager_SetIntValue(TW_NANDROID_ANDSEC_VAR, 0);
	            		tw_total--;
	            	} else {
	            		DataManager_SetIntValue(TW_NANDROID_ANDSEC_VAR, 1);
	            		tw_total++;
	            	}
				}
				break;
			case ITEM_NAN_SDEXT:
				if (tw_nan_sdext_x != -1) {
	            	if (DataManager_GetIntValue(TW_NANDROID_SDEXT_VAR)) {
	            		DataManager_SetIntValue(TW_NANDROID_SDEXT_VAR, 0);
	            		tw_total--;
	            	} else {
	            		DataManager_SetIntValue(TW_NANDROID_SDEXT_VAR, 1);
	            		tw_total++;
	           		}
				}
				break;
			case ITEM_NAN_COMPRESS:
            	DataManager_ToggleIntValue(TW_USE_COMPRESSION_VAR);
				break;
			case ITEM_NAN_BACK:
            	dec_menu_loc();
				return;
		}
	    if (go_home) { 
	        dec_menu_loc();
	        return;
	    }
		break;
	}
	ui_end_menu(); // end menu
    dec_menu_loc(); // decrease menu location
	nan_backup_menu(pIdx); // restart menu (to refresh it)
}
示例#2
0
void
nan_backup_menu(int pIdx)
{
	tw_total = 0;
	char* nan_b_headers[] = { "Nandroid Backup",
							   "Choose Backup Options:",
							   NULL	};
	
	char* nan_b_items[] = { "--> Backup Naowz!",
							 nan_img_set(ITEM_NAN_SYSTEM,0),
							 nan_img_set(ITEM_NAN_DATA,0),
							 nan_img_set(ITEM_NAN_BOOT,0),
							 nan_img_set(ITEM_NAN_RECOVERY,0),
							 nan_img_set(ITEM_NAN_CACHE,0),
							 nan_img_set(ITEM_NAN_WIMAX,0),
							 nan_img_set(ITEM_NAN_ANDSEC,0),
							 nan_img_set(ITEM_NAN_SDEXT,0),
							 nan_compress(),
							 "<-- Back To Nandroid Menu",
							 NULL };

	char** headers = prepend_title(nan_b_headers);
	
    inc_menu_loc(ITEM_NAN_BACK);
	for (;;)
	{
		int chosen_item = get_menu_selection(headers, nan_b_items, 0, pIdx); // get key presses
		pIdx = chosen_item; // remember last selection location
		switch (chosen_item)
		{
			case ITEM_NAN_BACKUP:
				if (tw_total > 0) // only call backup if something was checked
				{
					nandroid_back_exe();
					dec_menu_loc();
					return;
				}
				break;
			case ITEM_NAN_SYSTEM:
            	if (is_true(tw_nan_system_val)) {
            		strcpy(tw_nan_system_val, "0"); // toggle's value
            		tw_total--;
            	} else {
            		strcpy(tw_nan_system_val, "1");
            		tw_total++;
            	}
                write_s_file();
                break;
			case ITEM_NAN_DATA:
            	if (is_true(tw_nan_data_val)) {
            		strcpy(tw_nan_data_val, "0");
            		tw_total--;
            	} else {
            		strcpy(tw_nan_data_val, "1");
            		tw_total++;
            	}
                write_s_file();
				break;
			case ITEM_NAN_BOOT:
            	if (is_true(tw_nan_boot_val)) {
            		strcpy(tw_nan_boot_val, "0");
            		tw_total--;
            	} else {
            		strcpy(tw_nan_boot_val, "1");
            		tw_total++;
            	}
                write_s_file();
				break;
			case ITEM_NAN_RECOVERY:
            	if (is_true(tw_nan_recovery_val)) {
            		strcpy(tw_nan_recovery_val, "0");
            		tw_total--;
            	} else {
            		strcpy(tw_nan_recovery_val, "1");
            		tw_total++;
            	}
                write_s_file();
				break;
			case ITEM_NAN_CACHE:
            	if (is_true(tw_nan_cache_val)) {
            		strcpy(tw_nan_cache_val, "0");
            		tw_total--;
            	} else {
            		strcpy(tw_nan_cache_val, "1");
            		tw_total++;
            	}
                write_s_file();
				break;
			case ITEM_NAN_WIMAX:
				if (tw_nan_wimax_x != -1)
				{
	            	if (is_true(tw_nan_wimax_val)) {
	            		strcpy(tw_nan_wimax_val, "0");
	            		tw_total--;
	            	} else {
	            		strcpy(tw_nan_wimax_val, "1");
	            		tw_total++;
	            	}
	                write_s_file();
				}
				break;
			case ITEM_NAN_ANDSEC:
				if (tw_nan_andsec_x != -1)
				{
	            	if (is_true(tw_nan_andsec_val)) {
	            		strcpy(tw_nan_andsec_val, "0");
	            		tw_total--;
	            	} else {
	            		strcpy(tw_nan_andsec_val, "1");
	            		tw_total++;
	            	}
	                write_s_file();
				}
				break;
			case ITEM_NAN_SDEXT:
				if (tw_nan_sdext_x != -1)
				{
	            	if (is_true(tw_nan_sdext_val)) {
	            		strcpy(tw_nan_sdext_val, "0");
	            		tw_total--;
	            	} else {
	            		strcpy(tw_nan_sdext_val, "1");
	            		tw_total++;
	           		}
	                write_s_file();
				}
				break;
			case ITEM_NAN_COMPRESS:
            	if (is_true(tw_use_compression_val)) {
            		strcpy(tw_use_compression_val, "0");
            	} else {
            		strcpy(tw_use_compression_val, "1");
           		}
                write_s_file();
				break;
			case ITEM_NAN_BACK:
            	dec_menu_loc();
				return;
		}
	    if (go_home) { 
	        dec_menu_loc();
	        return;
	    }
		break;
	}
	ui_end_menu(); // end menu
    dec_menu_loc();
	nan_backup_menu(pIdx); // restart menu (to refresh it)
}