| 56 | #define INTER_LOAD_Y 22 |
| 57 | |
| 58 | static struct td_list_head *interface_load_ncurses(disk_t *disk_car, backup_disk_t *backup_list) |
| 59 | { |
| 60 | int offset=0; |
| 61 | int backup_current_num=0; |
| 62 | int rewrite=1; |
| 63 | unsigned int menu=3; /* default : quit */ |
| 64 | struct td_list_head *backup_current=backup_list->list.next; |
| 65 | struct td_list_head *backup_walker=NULL; |
| 66 | const struct MenuItem menuLoadBackup[]= |
| 67 | { |
| 68 | { 'P', "Previous",""}, |
| 69 | { 'N', "Next","" }, |
| 70 | { 'L',"Load","Load partition structure from backup and try to locate partition"}, |
| 71 | { 'Q',"Cancel","Don't use backup and try to locate partition"}, |
| 72 | { 0, NULL, NULL } |
| 73 | }; |
| 74 | char options[20]; |
| 75 | while(1) |
| 76 | { |
| 77 | int i; |
| 78 | if(rewrite) |
| 79 | { |
| 80 | aff_copy(stdscr); |
| 81 | mvwaddstr(stdscr,4,0,disk_car->description(disk_car)); |
| 82 | if(!td_list_empty(&backup_list->list)) |
| 83 | { |
| 84 | mvwaddstr(stdscr,5,0,"Choose the backup you want to restore:"); |
| 85 | mvwaddstr(stdscr,20,0,"PS: Don't worry, you will have to confirm the partition restoration."); |
| 86 | } |
| 87 | else |
| 88 | { |
| 89 | mvwaddstr(stdscr,5,0,"No backup found!"); |
| 90 | } |
| 91 | rewrite=0; |
| 92 | } |
| 93 | if(!td_list_empty(&backup_list->list)) |
| 94 | { |
| 95 | backup_disk_t *backup=NULL; |
| 96 | for(i=0,backup_walker=backup_list->list.next; |
| 97 | backup_walker!=&backup_list->list && i<offset+INTER_LOAD; |
| 98 | backup_walker=backup_walker->next,i++) |
| 99 | { |
| 100 | if(i<offset) |
| 101 | continue; |
| 102 | backup=td_list_entry(backup_walker, backup_disk_t, list); |
| 103 | wmove(stdscr,8+i-offset,0); |
| 104 | wclrtoeol(stdscr); /* before addstr for BSD compatibility */ |
| 105 | if(backup_walker==backup_current) |
| 106 | { |
| 107 | wattrset(stdscr, A_REVERSE); |
| 108 | wprintw(stdscr,">%s %s",backup->description,ctime(&backup->my_time)); |
| 109 | wattroff(stdscr, A_REVERSE); |
| 110 | } else |
| 111 | { |
| 112 | wprintw(stdscr," %s %s",backup->description,ctime(&backup->my_time)); |
| 113 | } |
| 114 | } |
| 115 | if(i<=INTER_LOAD && backup==NULL) |
no test coverage detected