- Menu *m;
- Action *a;
-
- menu_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
- menu_destroy_hash_key,
- (GDestroyNotify)menu_destroy_hash_value);
- menu_map = g_hash_table_new(g_int_hash, g_int_equal);
-
- m = menu_new("sex menu", "root", NULL);
- a = action_from_string("execute");
- a->data.execute.path = g_strdup("xterm");
- menu_add_entry(m, menu_entry_new("xterm", a));
- a = action_from_string("restart");
- menu_add_entry(m, menu_entry_new("restart", a));
- menu_add_entry(m, menu_entry_new("--", NULL));
- a = action_from_string("exit");
- menu_add_entry(m, menu_entry_new("exit", a));
-
- m = menu_new("client menu", "client", NULL);
- a = action_from_string("iconify");
- menu_add_entry(m, menu_entry_new("iconify", a));
- a = action_from_string("toggleshade");
- menu_add_entry(m, menu_entry_new("(un)shade", a));
- a = action_from_string("togglemaximizefull");
- menu_add_entry(m, menu_entry_new("(un)maximize", a));
- a = action_from_string("close");
- menu_add_entry(m, menu_entry_new("close", a));
+ ObMenuParseState *state = data;
+ gchar *label;
+
+ if (state->parent) {
+ if (parse_attr_string("label", node, &label)) {
+ GSList *acts = NULL;
+
+ for (node = node->children; node; node = node->next)
+ if (!xmlStrcasecmp(node->name, (const xmlChar*) "action")) {
+ ObAction *a = action_parse
+ (i, doc, node, OB_USER_ACTION_MENU_SELECTION);
+ if (a)
+ acts = g_slist_append(acts, a);
+ }
+ menu_add_normal(state->parent, -1, label, acts);
+ g_free(label);
+ }
+ }