# HG changeset patch # User Olaf Wintermann # Date 1759173286 -7200 # Node ID b84cbe57e0bda5ef6f7045184d1c250df51ca2b3 # Parent 85b6cef7fcba62b2802b1610d5662f66c1fece26 change UiCellValue from struct to union and pass it as pointer to the onsave function, for better compatibility with other languages diff -r 85b6cef7fcba -r b84cbe57e0bd application/main.c --- 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; } diff -r 85b6cef7fcba -r b84cbe57e0bd ui/gtk/list.c --- 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) { diff -r 85b6cef7fcba -r b84cbe57e0bd ui/ui/tree.h --- 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 { /*