]> uap-core.de Git - note.git/commitdiff
also create a Notebook object with the Resource object, when creating a new notebook
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Thu, 22 May 2025 14:31:36 +0000 (16:31 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Thu, 22 May 2025 14:31:36 +0000 (16:31 +0200)
application/store.c
application/window.c

index 21c62f3a27b6978b371adcd55c3ecd0708444aa4..dd852e8f419e9cc3a20402b48e582747e5ae4d86 100644 (file)
@@ -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, &notebook_id)) {
+                if(dbuResultAsInt64(result2, &job->resource->notebook->notebook_id)) {
                     job->error = 4;
-                } else {
-                    // TODO: create notebook object
                 }
             }
             dbuQueryFree(q2);
index 261ca667870bf66b95ec31757e53202d97279962..5f901c2a0bdd5893c485aa58ccc539b85c47bf67 100644 (file)
@@ -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;