430 // enable/disable group widgets |
430 // enable/disable group widgets |
431 uic_check_group_widgets(ctx); |
431 uic_check_group_widgets(ctx); |
432 } |
432 } |
433 |
433 |
434 int* ui_active_groups(UiContext *ctx, int *ngroups) { |
434 int* ui_active_groups(UiContext *ctx, int *ngroups) { |
|
435 if(!ctx->groups) { |
|
436 return NULL; |
|
437 } |
|
438 |
435 int nelm = ucx_list_size(ctx->groups); |
439 int nelm = ucx_list_size(ctx->groups); |
436 int *groups = calloc(sizeof(int), nelm); |
440 int *groups = calloc(sizeof(int), nelm); |
437 |
441 |
438 int i = 0; |
442 int i = 0; |
439 UCX_FOREACH(elm, ctx->groups) { |
443 UCX_FOREACH(elm, ctx->groups) { |
468 } |
472 } |
469 } |
473 } |
470 ui_set_enabled(gw->widget, enable); |
474 ui_set_enabled(gw->widget, enable); |
471 } |
475 } |
472 |
476 |
473 free(groups); |
477 if(groups) { |
|
478 free(groups); |
|
479 } |
474 } |
480 } |
475 |
481 |
476 void uic_add_group_widget(UiContext *ctx, void *widget, UcxList *groups) { |
482 void uic_add_group_widget(UiContext *ctx, void *widget, UcxList *groups) { |
477 UcxMempool *mp = ctx->mempool; |
483 UcxMempool *mp = ctx->mempool; |
478 UiGroupWidget *gw = ucx_mempool_malloc(mp, sizeof(UiGroupWidget)); |
484 UiGroupWidget *gw = ucx_mempool_malloc(mp, sizeof(UiGroupWidget)); |