From 3bd14bf30995c8960f1ce83eacf6c2597878cc50 Mon Sep 17 00:00:00 2001 From: Olaf Wintermann Date: Thu, 22 May 2025 16:31:36 +0200 Subject: [PATCH] also create a Notebook object with the Resource object, when creating a new notebook --- application/store.c | 7 ++----- application/window.c | 2 ++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/application/store.c b/application/store.c index 21c62f3..dd852e8 100644 --- a/application/store.c +++ b/application/store.c @@ -809,7 +809,7 @@ static int qthr_new_notebook(CreateNotebookJob *job) { DBUResult *result = dbuQueryGetResult(q); if(dbuResultAsInt64(result, &job->resource->resource_id)) { job->error = 2; - } else { + } else if(job->resource->notebook) { DBUQuery *q2 = connection->createQuery(connection, NULL); dbuQuerySetSQL(q2, SQL_NOTEBOOK_NEW); dbuQuerySetParamInt64(q2, 1, job->resource->resource_id); @@ -817,11 +817,8 @@ static int qthr_new_notebook(CreateNotebookJob *job) { job->error = 3; } else { DBUResult *result2 = dbuQueryGetResult(q2); - int64_t notebook_id; - if(dbuResultAsInt64(result2, ¬ebook_id)) { + if(dbuResultAsInt64(result2, &job->resource->notebook->notebook_id)) { job->error = 4; - } else { - // TODO: create notebook object } } dbuQueryFree(q2); diff --git a/application/window.c b/application/window.c index 261ca66..5f901c2 100644 --- a/application/window.c +++ b/application/window.c @@ -299,6 +299,8 @@ static void action_nnd_button(UiEvent *event, void *userdata) { notebook->parent_id = parent->resource_id; notebook->nodename = cx_strdup_a(store->mp->allocator, name).ptr; + notebook->notebook = cxCalloc(store->mp->allocator, 1, sizeof(Notebook)); + NotebookCreatedResult *result = malloc(sizeof(NotebookCreatedResult)); result->window = wdata->parent; result->parent = parent; -- 2.43.5