diff -r 36f1581b43e2 -r 40dbf1a7526a ui/common/context.c --- a/ui/common/context.c Sun Jan 24 12:39:05 2016 +0100 +++ b/ui/common/context.c Sun Jan 24 18:47:39 2016 +0100 @@ -38,19 +38,14 @@ UiContext* uic_context(UiObject *toplevel, UcxMempool *mp) { UiContext *ctx = ucx_mempool_malloc(mp, sizeof(UiContext)); - ctx->parent = NULL; + memset(ctx, 0, sizeof(UiContext)); ctx->mempool = mp; - ctx->document = NULL; ctx->obj = toplevel; ctx->vars = ucx_map_new_a(mp->allocator, 16); - ctx->groups = NULL; - ctx->group_widgets = NULL; ctx->set_document = uic_context_set_document; ctx->detach_document = uic_context_detach_document; - ctx->title = NULL; - #ifdef UI_GTK if(toplevel->widget) { ctx->accel_group = gtk_accel_group_new(); @@ -334,6 +329,11 @@ // public API +void ui_context_closefunc(UiContext *ctx, ui_callback fnc, void *udata) { + ctx->close_callback = fnc; + ctx->close_data = udata; +} + int ui_getint(UiObject *obj, char *name) { UiVar *var = uic_get_var(obj->ctx, name); if(var) {