]> uap-core.de Git - note.git/commitdiff
add newly created notes to the notes list and not when they are saved the first time
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Sat, 3 May 2025 19:54:15 +0000 (21:54 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Sat, 3 May 2025 19:54:15 +0000 (21:54 +0200)
application/note.c
application/notebook.c

index c1d1bf495cf30c88fdfc3e17a59d1ddb14a80ae9..ffa0d94faa09b612ce6c1e82537a870680f8678f 100644 (file)
@@ -198,11 +198,6 @@ void note_save(UiObject *obj, NotebookModel *notebook, Resource *note) {
     if(note->resource_id == 0) {
         // new note
         note_store_new_note_async(obj, note, NULL, NULL);
-        notebook->disable_selection_events = TRUE;
-        int index = notebook->notes->count(notebook->notes);
-        ui_list_append(notebook->notes, note);
-        notebook->notes->update(notebook->notes, index);
-        notebook->disable_selection_events = FALSE;
     } else {
         note_store_save_note_async(obj, note, NULL, NULL);
     }
index 14140daeb0010f26b97dfcdf6706b18b790d5f30..5b92dd390314edeeb6cba15025278f5962ff8db5 100644 (file)
@@ -206,6 +206,9 @@ void notebookmodel_new_note(NotebookModel *model) {
     // initialize note content
     // possible to implement something like note templates here
     editor_load_markdown(new_note, model->window->textview, cx_mutstrn("", 0));
+    
+    ui_list_append(model->notes, new_note);
+    ui_list_update(model->notes);
 }
 
 typedef struct NoteDeleteOp {