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 (file[0] == '/') {
+ if (!parse_load(file, "openbox_menu", doc, node)) {
+ g_warning("Failed to load menu from '%s'", file);
+ loaded = FALSE;
+ }
+ } else {
+ p = g_build_filename(g_get_home_dir(), ".openbox", file, NULL);
if (!parse_load(p, "openbox_menu", doc, node)) {
g_free(p);
- p = g_strdup(file);
+ p = g_build_filename(RCDIR, file, NULL);
if (!parse_load(p, "openbox_menu", doc, node)) {
- g_warning("Failed to load menu from '%s'", file);
- loaded = FALSE;
+ 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;
+ }
}
}
+ g_free(p);
}
- g_free(p);
return loaded;
}
for (it = config_menu_files; it; it = g_slist_next(it)) {
if (menu_open(it->data, &doc, &node)) {
loaded = TRUE;
- parse_tree(menu_parse_inst, doc, node->xmlChildrenNode);
+ parse_tree(menu_parse_inst, doc, node->children);
xmlFreeDoc(doc);
}
}
if (!loaded) {
if (menu_open("menu.xml", &doc, &node)) {
- parse_tree(menu_parse_inst, doc, node->xmlChildrenNode);
+ parse_tree(menu_parse_inst, doc, node->children);
xmlFreeDoc(doc);
}
}
if (!self->execute)
return;
- if (!g_spawn_command_line_sync(self->execute, &output, NULL, NULL, &err))
- {
+ if (!g_spawn_command_line_sync(self->execute, &output, NULL, NULL, &err)) {
g_warning("Failed to execute command for pipe-menu: %s", err->message);
g_error_free(err);
return;
menu_parse_state.pipe_creator = self;
menu_parse_state.parent = self;
- parse_tree(menu_parse_inst, doc, node->xmlChildrenNode);
+ parse_tree(menu_parse_inst, doc, node->children);
xmlFreeDoc(doc);
} else {
g_warning("Invalid output from pipe-menu: %s", self->execute);
if (parse_attr_string("label", node, &label)) {
GSList *acts = NULL;
- for (node = node->xmlChildrenNode; node; node = node->next)
+ for (node = node->children; node; node = node->next)
if (!xmlStrcasecmp(node->name, (const xmlChar*) "action"))
- acts = g_slist_append(acts, action_parse(i, doc, node));
+ acts = g_slist_append(acts, action_parse
+ (i, doc, node,
+ OB_USER_ACTION_MENU_SELECTION));
menu_add_normal(state->parent, -1, label, acts);
g_free(label);
}
old = state->parent;
state->parent = menu;
- parse_tree(i, doc, node->xmlChildrenNode);
+ parse_tree(i, doc, node->children);
state->parent = old;
}
}