Change Gadget struct to double linked list

 *replace Gadget struct member 'last' to 'prev'
 *prev not only can find last by using head->prev
 *but also can insert nodes more convenient