diff -r 1524b5dc4d4d -r 0accf125a65f ui/gtk/menu.c --- a/ui/gtk/menu.c Thu Apr 16 17:41:35 2026 +0200 +++ b/ui/gtk/menu.c Fri Apr 17 13:21:11 2026 +0200 @@ -37,6 +37,7 @@ #include "../common/context.h" #include "../common/menu.h" #include "../common/types.h" +#include "../common/action.h" #include "../ui/properties.h" #include "../ui/window.h" #include "container.h" @@ -590,7 +591,15 @@ cxListFree(groups); } - if(i->callback != NULL) { + if(i->action) { + uic_bind_action(obj->ctx, i->action, action, (ui_enablefunc)action_enable); + UiAction *ui_action = uic_resolve_action(obj->ctx, i->action); + if(!ui_action) { + action_enable(action, FALSE); + } + } + + if(i->callback != NULL || i->action) { UiEventData *event = malloc(sizeof(UiEventData)); event->obj = obj; event->userdata = i->userdata; @@ -598,6 +607,7 @@ event->value = 0; event->customdata = NULL; event->customint = 0; + event->action = i->action ? strdup(i->action) : NULL; g_signal_connect( action, @@ -607,13 +617,13 @@ g_signal_connect( obj->widget, "destroy", - G_CALLBACK(ui_destroy_userdata), + G_CALLBACK(ui_destroy_eventdata), event); } char action_name[32]; snprintf(action_name, 32, "win.%s", item->id); - + g_menu_append(parent, i->label, action_name); } @@ -888,7 +898,12 @@ evt.eventdatatype = uic_get_tmp_eventdata_type(); } evt.intval = intval; - event->callback(&evt, event->userdata); + if(event->callback) { + event->callback(&evt, event->userdata); + } + if(event->action) { + uic_action_callback(&evt, event->action); + } uic_set_tmp_eventdata(NULL, 0); }