fix sourcelist update (GTK)

Tue, 13 May 2025 20:21:48 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 13 May 2025 20:21:48 +0200
changeset 591
637de2359995
parent 589
4d86050ad6ff
child 592
c69a71927d9c

fix sourcelist update (GTK)

ui/gtk/list.c file | annotate | diff | comparison | revisions
--- a/ui/gtk/list.c	Tue May 06 15:24:39 2025 +0200
+++ b/ui/gtk/list.c	Tue May 13 20:21:48 2025 +0200
@@ -1810,7 +1810,7 @@
             list->obj = uilistbox;
             list->update = ui_listbox_dynamic_update;
             
-            ui_listbox_dynamic_update(list, 0);
+            ui_listbox_dynamic_update(list, -1);
         }
     }
     
@@ -1843,6 +1843,15 @@
     // unbind/free previous list vars
     CxIterator i = cxListIterator(uilistbox->sublists);
     cx_foreach(UiListBoxSubList *, s, i) {
+        // TODO: "unbind/free previous list vars" will also remove
+        //       the widget list. This makes the widget optimization 
+        //       in ui_listbox_update_sublist pointless
+        //       Is it actually possible to not recreate the whole list?
+        CxIterator r = cxListIterator(s->widgets);
+        cx_foreach(GtkWidget*, widget, r) {
+            LISTBOX_REMOVE(uilistbox->listbox, widget);
+        }
+        
         if(s->var) {
             UiList *sl = s->var->value;
             sl->obj = NULL;

mercurial