void init_menu()

in tools/testapp/main.c [95:116]


void init_menu(DbusmenuMenuitem *root, const char *filename)
{
	JsonParser * parser = json_parser_new();
	GError * error = NULL;
	if (!json_parser_load_from_file(parser, filename, &error)) {
		g_debug("Failed parsing file %s because: %s", filename, error->message);
		return;
	}
	JsonNode * root_node = json_parser_get_root(parser);
	if (JSON_NODE_TYPE(root_node) != JSON_NODE_ARRAY) {
		g_debug("Root node is not an array, fail.  It's an: %s", json_node_type_name(root_node));
		return;
	}

	JsonArray * root_array = json_node_get_array(root_node);
	int pos;
	int count = json_array_get_length(root_array);
	for (pos=0; pos < count; ++pos) {
		DbusmenuMenuitem *child = layout2menuitem(json_array_get_element(root_array, pos));
		dbusmenu_menuitem_child_append(root, child);
	}
}