}
void notebookmodel_detach(NotebookModel *model) {
- // TODO: workaround for a toolkit bug, that reattaching a document
- // that has sub-documents will not update all bindings
if(model->current_note) {
- //int i = ui_get(model->current_note->model->type);
- //printf("type: %d\n", i);
+ // TODO: model->modified doesnt work yet, remove || 1 when it works
+ if(model->current_note->model->modified || 1) {
+ note_save(model->window->obj, model, model->current_note);
+ }
+
+ // TODO: workaround for a toolkit bug, that reattaching a document
+ // with sub-documents will not update all bindings
ui_detach_document(model->ctx, model->current_note->model);
model->current_note = NULL;
}
- if(model->current_note && model->current_note->model->modified) {
- //notebookmodel_detach_current_note(model);
- note_save(model->window->obj, model, model->current_note);
- }
-
if(model->window) {
ui_detach_document(model->window->obj->ctx, model);
model->window->current_notebook = NULL;