# HG changeset patch # User Olaf Wintermann # Date 1760783032 -7200 # Node ID 670b2c03413f64cec97d78cd46f6aded1fc6d9c7 # Parent 34b07b18b3e1c03a672e569603b428429f25ac1e add ui_srclist_generate_sublist_num_data function diff -r 34b07b18b3e1 -r 670b2c03413f ui/common/wrapper.c --- a/ui/common/wrapper.c Sat Oct 18 10:17:59 2025 +0200 +++ b/ui/common/wrapper.c Sat Oct 18 12:23:52 2025 +0200 @@ -134,6 +134,17 @@ return ui_list_count(list); } +/* + * numerates all sublists and sets the sublist index as userdata + */ +void ui_srclist_generate_sublist_num_data(UiList *list) { + CxList *cxlist = list->data; + CxIterator i = cxListIterator(cxlist); + cx_foreach(UiSubList *, sublist, i) { + sublist->userdata = (void*)i.index; + } +} + /* ---------------------------- UiSubListEventData ---------------------------- */ diff -r 34b07b18b3e1 -r 670b2c03413f ui/common/wrapper.h --- a/ui/common/wrapper.h Sat Oct 18 10:17:59 2025 +0200 +++ b/ui/common/wrapper.h Sat Oct 18 12:23:52 2025 +0200 @@ -58,6 +58,7 @@ UIEXPORT void ui_srclist_remove(UiList *list, int index); UIEXPORT void ui_srclist_clear(UiList *list); UIEXPORT int ui_srclist_size(UiList *list); +UIEXPORT void ui_srclist_generate_sublist_num_data(UiList *list); UIEXPORT UiList* ui_sublist_event_get_list(UiSubListEventData *event); UIEXPORT int ui_sublist_event_get_sublist_index(UiSubListEventData *event); diff -r 34b07b18b3e1 -r 670b2c03413f ui/gtk/list.c --- a/ui/gtk/list.c Sat Oct 18 10:17:59 2025 +0200 +++ b/ui/gtk/list.c Sat Oct 18 12:23:52 2025 +0200 @@ -2579,6 +2579,10 @@ item.label = strdup(elm); } + if(item.label == NULL && index == -1 && sublist->header) { + item.label = strdup(sublist->header); + } + // create listbox item GtkWidget *row = gtk_list_box_row_new(); #if GTK_CHECK_VERSION(4, 0, 0)