-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keep the order of the add-on context menu items as defined in the addon.xml file #14220
Conversation
|
||
ELEMENTS elems; | ||
if (CServiceBroker::GetAddonMgr().GetExtElements(elem, "item", elems)) | ||
for (unsigned int i = 0; i < elem->num_children; i++) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
xbmc/addons/ContextMenuAddon.cpp
Outdated
{ | ||
for (const auto& elem : elems) | ||
cp_cfg_element_t subElem = elem->children[i]; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
xbmc/addons/ContextMenuAddon.cpp
Outdated
{ | ||
for (const auto& elem : elems) | ||
cp_cfg_element_t subElem = elem->children[i]; | ||
std::string elementName = subElem.name; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
xbmc/addons/ContextMenuAddon.cpp
Outdated
for (const auto& elem : elems) | ||
cp_cfg_element_t subElem = elem->children[i]; | ||
std::string elementName = subElem.name; | ||
if (elementName.compare("menu") == 0) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
xbmc/addons/ContextMenuAddon.cpp
Outdated
auto label = CServiceBroker::GetAddonMgr().GetExtValue(elem, "label"); | ||
auto visCondition = CServiceBroker::GetAddonMgr().GetExtValue(&subElem, "visible"); | ||
auto library = CServiceBroker::GetAddonMgr().GetExtValue(&subElem, "@library"); | ||
auto label = CServiceBroker::GetAddonMgr().GetExtValue(&subElem, "label"); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
xbmc/addons/ContextMenuAddon.cpp
Outdated
auto label = CServiceBroker::GetAddonMgr().GetExtValue(elem, "label"); | ||
auto visCondition = CServiceBroker::GetAddonMgr().GetExtValue(&subElem, "visible"); | ||
auto library = CServiceBroker::GetAddonMgr().GetExtValue(&subElem, "@library"); | ||
auto label = CServiceBroker::GetAddonMgr().GetExtValue(&subElem, "label"); | ||
if (StringUtils::IsNaturalNumber(label)) | ||
label = g_localizeStrings.GetAddonString(addonInfo.ID(), atoi(label.c_str())); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
…n the addon.xml file
7d17220
to
d9a9937
Compare
Looks ok to me |
Ok, thanks for your feedback! |
Jenkins is green and only +1 until now, so merging... |
Kodi add-ons can define context menu items via the
<extension point="kodi.context.item">
extension point. However, the order of these menu items are not respected and sorting is done by label.Description
I removed the sorting by label to find out that Kodi first reads the sub-menus and then the menu items. So instead of first doing the sub-menus and then the items, I now iterate over all the child-items in order and either treat them as a menu or an item.
Motivation and Context
It allows an add-on dev to order their context menus in a better way.
How Has This Been Tested?
Tested it locally on Windows x64.
Types of change
Checklist: