4 Menu
*menu_new(char *label
, Menu
*parent
)
6 Menu
*new_menu
= g_new(Menu
, 1);
7 new_menu
->label
= g_strdup(lable
);
8 new_menu
->parent
= parent
;
10 new_menu
->entries
= NULL
;
11 new_menu
->tail
= NULL
;
12 new_menu
->shown
= FALSE
;
13 new_menu
->invalid
= FALSE
;
14 /* default controllers? */
19 MenuEntry
*menu_entry_new_full(char *label
, Action
*action
,
20 MenuEntryRenderType render_type
,
21 gpointer render_data
, gpointer submenu
)
23 MenuEntry
*menu_entry
= g_new(MenuEntry
, 1);
25 menu_entry
->label
= g_strdup(label
);
26 menu_entry
->action
.func
= action
->func
;
27 menu_entry
->action
.data
= action
->data
; //watch out. copying Client * ptr
29 menu_entry
->render_data
= render_data
; //watch out.
30 menu_entry
->submenu
= submenu
;
35 void menu_entry_set_submenu(MenuEntry
*entry
, Menu
*submenu
)
37 assert(entry
!= NULL
);
39 entry
->submenu
= submenu
;
41 if(entry
->parent
!= NULL
)
42 entry
->parent
->invalid
= TRUE
;
45 void menu_add_entry(Menu
*menu
, MenuEntry
*entry
)
47 assert(menu
!= NULL
&& entry
!= NULL
);
49 menu
->entries
= g_list_append(menu
->entries
, entry
);