ui/gtk/menu.c

changeset 95
e92c72705da4
parent 88
e27526429d85
child 98
16e84fac48bd
--- a/ui/gtk/menu.c	Wed Nov 27 17:14:57 2024 +0100
+++ b/ui/gtk/menu.c	Wed Nov 27 18:45:08 2024 +0100
@@ -35,6 +35,7 @@
 #include "toolkit.h"
 #include "../common/context.h"
 #include "../common/menu.h"
+#include "../common/types.h"
 #include "../ui/properties.h"
 #include "../ui/window.h"
 #include "container.h"
@@ -252,10 +253,9 @@
     ls->callback = il->callback;
     ls->userdata = il->userdata;
     
-    ls->list->observers = ui_add_observer(
-            ls->list->observers,
-            (ui_callback)ui_update_menuitem_list,
-            ls);
+    UiObserver *observer = ui_observer_new((ui_callback)ui_update_menuitem_list, ls);
+    list->observers = ui_obsvlist_add(list->observers, observer);
+    uic_list_register_observer_destructor(obj->ctx, list, observer);
     
     ui_update_menuitem_list(NULL, ls);
 }
@@ -510,10 +510,9 @@
     ls->callback = il->callback;
     ls->userdata = il->userdata;
     
-    list->observers = ui_add_observer(
-            list->observers,
-            (ui_callback)ui_update_gmenu_item_list,
-            ls);
+    UiObserver *observer = ui_observer_new((ui_callback)ui_update_gmenu_item_list, ls);
+    list->observers = ui_obsvlist_add(list->observers, observer);
+    uic_list_register_observer_destructor(obj->ctx, list, observer);
     
     GSimpleAction *action = g_simple_action_new(item->id, g_variant_type_new("i"));
     g_action_map_add_action(obj->ctx->action_map, G_ACTION(action));

mercurial