- Action *act;
- xmlNodePtr nact;
-
- gchar *id = NULL, *title = NULL, *label = NULL, *plugin;
- ObMenu *menu = NULL, *parent;
-
- if (newmenu == TRUE) {
- if (!parse_attr_string("id", node, &id))
- goto parse_menu_fail;
- if (!parse_attr_string("label", node, &title))
- goto parse_menu_fail;
- ob_debug("menu label %s\n", title);
-
- if (parse_attr_string("plugin", node, &plugin)) {
- PluginMenuCreateData data;
- data.doc = doc;
- data.node = node;
- data.parent = menu;
- parent = plugin_create(plugin, &data);
- g_free(plugin);
- } else
- menu = menu_new(title, id, data ? *((ObMenu**)data) : NULL);
-
- if (data)
- *((ObMenu**)data) = menu;
- } else {
- menu = (ObMenu *)data;
- }
-
- node = node->xmlChildrenNode;
-
- while (node) {
- if (!xmlStrcasecmp(node->name, (const xmlChar*) "menu")) {
- if (parse_attr_string("plugin", node, &plugin)) {
- PluginMenuCreateData data;
- data.doc = doc;
- data.node = node;
- data.parent = menu;
- parent = plugin_create(plugin, &data);
- g_free(plugin);
- } else {
- parent = menu;
- parse_menu(doc, node, &parent);
- menu_add_entry(menu, menu_entry_new_submenu(parent->label,
- parent));
- }
-
- }
- else if (!xmlStrcasecmp(node->name, (const xmlChar*) "item")) {
- if (parse_attr_string("label", node, &label)) {
- if ((nact = parse_find_node("action", node->xmlChildrenNode)))
- act = action_parse(doc, nact);
- else
- act = NULL;
- if (act)
- menu_add_entry(menu, menu_entry_new(label, act));
- else
- menu_add_entry(menu, menu_entry_new_separator(label));
- g_free(label);
+ GSList *menus;
+};
+
+static void menu_destroy_hash_value(ObMenu *self);
+static void parse_menu_item(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
+ gpointer data);
+static void parse_menu_separator(ObParseInst *i,
+ xmlDocPtr doc, xmlNodePtr node,
+ gpointer data);
+static void parse_menu(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
+ gpointer data);
+
+static gboolean menu_open(gchar *file, xmlDocPtr *doc, xmlNodePtr *node)
+{
+ gboolean loaded = TRUE;
+ gchar *p;
+
+ p = g_build_filename(g_get_home_dir(), ".openbox", file, NULL);
+ if (!parse_load(p, "openbox_menu", doc, node)) {
+ g_free(p);
+ p = g_build_filename(RCDIR, file, NULL);
+ if (!parse_load(p, "openbox_menu", doc, node)) {
+ g_free(p);
+ p = g_strdup(file);
+ if (!parse_load(p, "openbox_menu", doc, node)) {
+ g_warning("Failed to load menu from '%s'", file);
+ loaded = FALSE;