- return XCreateWindow(ob_display, parent, 0, 0, 1, 1, 0,
- RrDepth(ob_rr_inst), InputOutput,
- RrVisual(ob_rr_inst), mask, attrib);
-
+ ObMenuParseState *state = data;
+ gchar *name = NULL, *title = NULL, *script = NULL;
+ ObMenu *menu;
+ ObMenuEntry *e;
+ gchar *icon;
+
+ if (!obt_xml_attr_string(node, "id", &name))
+ goto parse_menu_fail;
+
+ if (!g_hash_table_lookup(menu_hash, name)) {
+ if (!obt_xml_attr_string_unstripped(node, "label", &title))
+ goto parse_menu_fail;
+
+ if ((menu = menu_new(name, title, TRUE, NULL))) {
+ menu->pipe_creator = state->pipe_creator;
+ if (obt_xml_attr_string(node, "execute", &script)) {
+ menu->execute = obt_paths_expand_tilde(script);
+ } else {
+ ObMenu *old;
+
+ old = state->parent;
+ state->parent = menu;
+ obt_xml_tree(menu_parse_inst, node->children);
+ state->parent = old;
+ }
+ }
+ }
+
+ if (state->parent) {
+ e = menu_add_submenu(state->parent, -1, name);
+
+ if (config_menu_show_icons &&
+ obt_xml_attr_string(node, "icon", &icon))
+ {
+ e->data.submenu.icon = RrImageNewFromName(ob_rr_icons, icon);
+
+ if (e->data.submenu.icon)
+ e->data.submenu.icon_alpha = 0xff;
+
+ g_free(icon);
+ }
+ }
+
+parse_menu_fail:
+ g_free(name);
+ g_free(title);
+ g_free(script);