ui/common/types.c

changeset 142
46448d38885c
parent 141
cc2170ea05ad
child 143
d499b29d7cb6
equal deleted inserted replaced
141:cc2170ea05ad 142:46448d38885c
79 } 79 }
80 observer = observer->next; 80 observer = observer->next;
81 } 81 }
82 } 82 }
83 83
84 void ui_notify_evt(UiObserver *observer, UiEvent *event) {
85 while(observer) {
86 observer->callback(event, observer->data);
87 observer = observer->next;
88 }
89 }
90
84 /* --------------------------- UiList --------------------------- */ 91 /* --------------------------- UiList --------------------------- */
85 92
86 UiList* ui_list_new(void) { 93 UiList* ui_list_new(void) {
87 UiList *list = malloc(sizeof(UiList)); 94 UiList *list = malloc(sizeof(UiList));
88 list->first = ui_list_first; 95 list->first = ui_list_first;
158 typedef struct { 165 typedef struct {
159 int type; 166 int type;
160 char *name; 167 char *name;
161 } UiColumn; 168 } UiColumn;
162 169
163 UiModelInfo* ui_model_info(UiContext *ctx, ...) { 170 UiModel* ui_model_info(UiContext *ctx, ...) {
164 UiModelInfo *info = ui_calloc(ctx, 1, sizeof(UiModelInfo)); 171 UiModel *info = ui_calloc(ctx, 1, sizeof(UiModel));
165 172
166 va_list ap; 173 va_list ap;
167 va_start(ap, ctx); 174 va_start(ap, ctx);
168 175
169 UcxList *cols = NULL; 176 UcxList *cols = NULL;
196 ucx_list_free(cols); 203 ucx_list_free(cols);
197 204
198 return info; 205 return info;
199 } 206 }
200 207
201 void ui_model_info_free(UiContext *ctx, UiModelInfo *mi) { 208 void ui_model_info_free(UiContext *ctx, UiModel *mi) {
202 ucx_mempool_free(ctx->mempool, mi->types); 209 ucx_mempool_free(ctx->mempool, mi->types);
203 ucx_mempool_free(ctx->mempool, mi->titles); 210 ucx_mempool_free(ctx->mempool, mi->titles);
204 ucx_mempool_free(ctx->mempool, mi); 211 ucx_mempool_free(ctx->mempool, mi);
205 } 212 }
206 213

mercurial