improve ui_listview_update2 and add todo for further improvements (GTK)

9 days ago

author
Olaf Winermann <olaf.wintermann@gmail.com>
date
Sun, 23 Mar 2025 18:21:45 +0100 (9 days ago)
changeset 504
f0c21da35aa4
parent 503
fefdfe7b2fc5
child 505
8002be179741

improve ui_listview_update2 and add todo for further improvements (GTK)

ui/gtk/list.c file | annotate | diff | comparison | revisions
--- a/ui/gtk/list.c	Sun Mar 23 18:09:24 2025 +0100
+++ b/ui/gtk/list.c	Sun Mar 23 18:21:45 2025 +0100
@@ -585,8 +585,9 @@
         void *value = list->get(list, i);
         if(value) {
             ObjWrapper *obj = obj_wrapper_new(value);
-            g_list_store_remove(view->liststore, i);
-            g_list_store_insert(view->liststore, i, obj);
+            // TODO: if index i is selected, the selection is lost
+            // is it possible to update the item without removing it?
+            g_list_store_splice(view->liststore, i, 1, (void **)&obj, 1);
         }
     }
 }

mercurial