Mon, 29 Sep 2025 21:14:46 +0200
change UiCellValue from struct to union and pass it as pointer to the onsave function, for better compatibility with other languages
| application/main.c | file | annotate | diff | comparison | revisions | |
| ui/gtk/list.c | file | annotate | diff | comparison | revisions | |
| ui/ui/tree.h | file | annotate | diff | comparison | revisions |
--- a/application/main.c Mon Sep 29 20:16:07 2025 +0200 +++ b/application/main.c Mon Sep 29 21:14:46 2025 +0200 @@ -570,8 +570,8 @@ ui_linkbutton_value_set(doc->link, label, uri); } -static UiBool list_save(UiList *list, int row, int col, UiCellValue value, void *userdata) { - printf("list new value at [%d, %d]: %s\n", row, col, value.string); +static UiBool list_save(UiList *list, int row, int col, UiCellValue *value, void *userdata) { + printf("list new value at [%d, %d]: %s\n", row, col, value->string); return FALSE; }
--- a/ui/gtk/list.c Mon Sep 29 20:16:07 2025 +0200 +++ b/ui/gtk/list.c Mon Sep 29 21:14:46 2025 +0200 @@ -160,7 +160,7 @@ const char *str = ENTRY_GET_TEXT(data->entry); UiCellValue value; value.string = str; - if(data->listview->onsave(list, data->row, data->col, value, data->listview->onsavedata)) { + if(data->listview->onsave(list, data->row, data->col, &value, data->listview->onsavedata)) { free(data->previous_value); data->previous_value = strdup(str); } else if(restore) {
--- a/ui/ui/tree.h Mon Sep 29 20:16:07 2025 +0200 +++ b/ui/ui/tree.h Mon Sep 29 21:14:46 2025 +0200 @@ -55,12 +55,14 @@ UI_STRING_EDITABLE } UiModelType; -typedef union UiCellValue { - const char *string; - int64_t i; +typedef struct UiCellValue { + union { + const char *string; + int64_t i; + }; } UiCellValue; -typedef UiBool (*ui_list_savefunc)(UiList *list, int row, int col, UiCellValue value, void *userdata); +typedef UiBool (*ui_list_savefunc)(UiList *list, int row, int col, UiCellValue *value, void *userdata); struct UiModel { /*