Better handling of nested categories

Uses the data returned by api_channel_categories->category_tree to
determine nesting (why did I not see this before!)