ui/gtk/menu.c

changeset 95
e92c72705da4
parent 88
e27526429d85
child 98
16e84fac48bd
equal deleted inserted replaced
94:7fdf1489b82f 95:e92c72705da4
33 33
34 #include "menu.h" 34 #include "menu.h"
35 #include "toolkit.h" 35 #include "toolkit.h"
36 #include "../common/context.h" 36 #include "../common/context.h"
37 #include "../common/menu.h" 37 #include "../common/menu.h"
38 #include "../common/types.h"
38 #include "../ui/properties.h" 39 #include "../ui/properties.h"
39 #include "../ui/window.h" 40 #include "../ui/window.h"
40 #include "container.h" 41 #include "container.h"
41 42
42 #include <cx/linked_list.h> 43 #include <cx/linked_list.h>
250 ls->list = var->value; 251 ls->list = var->value;
251 252
252 ls->callback = il->callback; 253 ls->callback = il->callback;
253 ls->userdata = il->userdata; 254 ls->userdata = il->userdata;
254 255
255 ls->list->observers = ui_add_observer( 256 UiObserver *observer = ui_observer_new((ui_callback)ui_update_menuitem_list, ls);
256 ls->list->observers, 257 list->observers = ui_obsvlist_add(list->observers, observer);
257 (ui_callback)ui_update_menuitem_list, 258 uic_list_register_observer_destructor(obj->ctx, list, observer);
258 ls);
259 259
260 ui_update_menuitem_list(NULL, ls); 260 ui_update_menuitem_list(NULL, ls);
261 } 261 }
262 262
263 263
508 UiList *list = var->value; 508 UiList *list = var->value;
509 509
510 ls->callback = il->callback; 510 ls->callback = il->callback;
511 ls->userdata = il->userdata; 511 ls->userdata = il->userdata;
512 512
513 list->observers = ui_add_observer( 513 UiObserver *observer = ui_observer_new((ui_callback)ui_update_gmenu_item_list, ls);
514 list->observers, 514 list->observers = ui_obsvlist_add(list->observers, observer);
515 (ui_callback)ui_update_gmenu_item_list, 515 uic_list_register_observer_destructor(obj->ctx, list, observer);
516 ls);
517 516
518 GSimpleAction *action = g_simple_action_new(item->id, g_variant_type_new("i")); 517 GSimpleAction *action = g_simple_action_new(item->id, g_variant_type_new("i"));
519 g_action_map_add_action(obj->ctx->action_map, G_ACTION(action)); 518 g_action_map_add_action(obj->ctx->action_map, G_ACTION(action));
520 snprintf(ls->action, 32, "win.%s", item->id); 519 snprintf(ls->action, 32, "win.%s", item->id);
521 520

mercurial