366 |
366 |
367 void ui_listview_update(UiList *list, int i) { |
367 void ui_listview_update(UiList *list, int i) { |
368 UiListView *view = list->obj; |
368 UiListView *view = list->obj; |
369 UiListModel *model = ui_list_model_new(view->obj, view->var, view->model); |
369 UiListModel *model = ui_list_model_new(view->obj, view->var, view->model); |
370 gtk_tree_view_set_model(GTK_TREE_VIEW(view->widget), GTK_TREE_MODEL(model)); |
370 gtk_tree_view_set_model(GTK_TREE_VIEW(view->widget), GTK_TREE_MODEL(model)); |
|
371 g_object_unref(G_OBJECT(model)); |
371 // TODO: free old model |
372 // TODO: free old model |
372 } |
373 } |
373 |
374 |
374 void ui_listview_destroy(GtkWidget *w, UiListView *v) { |
375 void ui_listview_destroy(GtkWidget *w, UiListView *v) { |
|
376 gtk_tree_view_set_model(GTK_TREE_VIEW(w), NULL); |
|
377 ui_destroy_boundvar(v->obj->ctx, v->var); |
|
378 // TODO: destroy model? |
|
379 free(v); |
|
380 } |
|
381 |
|
382 void ui_combobox_destroy(GtkWidget *w, UiListView *v) { |
|
383 gtk_combo_box_set_model(GTK_COMBO_BOX(w), NULL); |
375 ui_destroy_boundvar(v->obj->ctx, v->var); |
384 ui_destroy_boundvar(v->obj->ctx, v->var); |
376 // TODO: destroy model? |
385 // TODO: destroy model? |
377 free(v); |
386 free(v); |
378 } |
387 } |
379 |
388 |