| 131 cxListAdd(ctx->documents, document); |
131 cxListAdd(ctx->documents, document); |
| 132 ctx->document = document; |
132 ctx->document = document; |
| 133 |
133 |
| 134 UiContext *doc_ctx = ui_document_context(document); |
134 UiContext *doc_ctx = ui_document_context(document); |
| 135 doc_ctx->parent = ctx; |
135 doc_ctx->parent = ctx; |
| |
136 doc_ctx->ref++; |
| 136 |
137 |
| 137 // if a document variable has the same name as a parent variable, |
138 // if a document variable has the same name as a parent variable, |
| 138 // move the bindings to the document |
139 // move the bindings to the document |
| 139 UiContext *var_ctx = ctx; |
140 UiContext *var_ctx = ctx; |
| 140 while(var_ctx) { |
141 while(var_ctx) { |
| 194 ctx->document = cxListAt(ctx->documents, 0); |
195 ctx->document = cxListAt(ctx->documents, 0); |
| 195 |
196 |
| 196 UiContext *docctx = ui_document_context(document); |
197 UiContext *docctx = ui_document_context(document); |
| 197 uic_context_unbind_vars(docctx); // unbind all doc/subdoc vars from the parent |
198 uic_context_unbind_vars(docctx); // unbind all doc/subdoc vars from the parent |
| 198 docctx->parent = NULL; |
199 docctx->parent = NULL; |
| |
200 ui_document_unref(document); |
| 199 |
201 |
| 200 ui_update_action_bindings(ctx); |
202 ui_update_action_bindings(ctx); |
| 201 } |
203 } |
| 202 |
204 |
| 203 void uic_context_detach_all(UiContext *ctx) { |
205 void uic_context_detach_all(UiContext *ctx) { |