ui/gtk/list.c

changeset 580
9b8d61227169
parent 504
f0c21da35aa4
child 591
637de2359995
equal deleted inserted replaced
579:810b848e2e4f 580:9b8d61227169
585 void *value = list->get(list, i); 585 void *value = list->get(list, i);
586 if(value) { 586 if(value) {
587 ObjWrapper *obj = obj_wrapper_new(value); 587 ObjWrapper *obj = obj_wrapper_new(value);
588 // TODO: if index i is selected, the selection is lost 588 // TODO: if index i is selected, the selection is lost
589 // is it possible to update the item without removing it? 589 // is it possible to update the item without removing it?
590 g_list_store_splice(view->liststore, i, 1, (void **)&obj, 1); 590 int count = g_list_model_get_n_items(G_LIST_MODEL(view->liststore));
591 if(count <= i) {
592 g_list_store_splice(view->liststore, i, 0, (void **)&obj, 1);
593 } else {
594 g_list_store_splice(view->liststore, i, 1, (void **)&obj, 1);
595 }
591 } 596 }
592 } 597 }
593 } 598 }
594 599
595 UiListSelection ui_listview_getselection2(UiList *list) { 600 UiListSelection ui_listview_getselection2(UiList *list) {

mercurial