]> Dogcows Code - chaz/openbox/blob - openbox/menu.c
clarify using stacking_lower for restoring the stacking order
[chaz/openbox] / openbox / menu.c
1 #include <glib.h>
2 #include "menu.h"
3
4 Menu *menu_new(char *label, Menu *parent)
5 {
6 Menu *new_menu = g_new(Menu, 1);
7 new_menu->label = g_strdup(lable);
8 new_menu->parent = parent;
9
10 new_menu->entries = NULL;
11 new_menu->tail = NULL;
12 new_menu->shown = FALSE;
13 new_menu->invalid = FALSE;
14 /* default controllers? */
15
16 return new_menu;
17 }
18
19 MenuEntry *menu_entry_new_full(char *label, Action *action,
20 MenuEntryRenderType render_type,
21 gpointer render_data, gpointer submenu)
22 {
23 MenuEntry *menu_entry = g_new(MenuEntry, 1);
24
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
28
29 menu_entry->render_data = render_data; //watch out.
30 menu_entry->submenu = submenu;
31
32 return menu_entry;
33 }
34
35 void menu_entry_set_submenu(MenuEntry *entry, Menu *submenu)
36 {
37 assert(entry != NULL);
38
39 entry->submenu = submenu;
40
41 if(entry->parent != NULL)
42 entry->parent->invalid = TRUE;
43 }
44
45 void menu_add_entry(Menu *menu, MenuEntry *entry)
46 {
47 assert(menu != NULL && entry != NULL);
48
49 menu->entries = g_list_append(menu->entries, entry);
50 entry->parent = menu;
51
52 menu->invalid = TRUE;
53 }
This page took 0.037846 seconds and 4 git commands to generate.