diff options
author | Thomas Amland <thomas.amland@gmail.com> | 2015-03-03 22:14:07 +0100 |
---|---|---|
committer | Thomas Amland <thomas.amland@gmail.com> | 2015-03-10 13:16:59 +0100 |
commit | 2f44b44d39e361325bdd0706bb99473c333652df (patch) | |
tree | c722faa96ab6caefc584f0c525f3d8f5e7208756 | |
parent | ad3af07cd3a194463f40e8b46ca34de53bb7f558 (diff) |
[addons] cleanup context menus in addon window
-change 'check for updates' to always do a repo update and move it to the side menu
-removes 'force refresh'
-fixes GetContextButtons in some cases not calling base
-rw-r--r-- | addons/resource.language.en_gb/resources/strings.po | 4 | ||||
-rw-r--r-- | addons/skin.confluence/720p/AddonBrowser.xml | 5 | ||||
-rw-r--r-- | addons/skin.confluence/addon.xml | 2 | ||||
-rw-r--r-- | addons/xbmc.gui/addon.xml | 2 | ||||
-rw-r--r-- | xbmc/addons/GUIWindowAddonBrowser.cpp | 63 |
5 files changed, 26 insertions, 50 deletions
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po index 607af485eb..48b2bd87db 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -12445,9 +12445,7 @@ msgctxt "#24034" msgid "Check for updates" msgstr "" -msgctxt "#24035" -msgid "Force refresh" -msgstr "" +#empty string id 24035 msgctxt "#24036" msgid "Change log" diff --git a/addons/skin.confluence/720p/AddonBrowser.xml b/addons/skin.confluence/720p/AddonBrowser.xml index a9b9427999..c65beddcc0 100644 --- a/addons/skin.confluence/720p/AddonBrowser.xml +++ b/addons/skin.confluence/720p/AddonBrowser.xml @@ -123,6 +123,11 @@ <include>ButtonCommonValues</include> <label>24999</label> </control> + <control type="button" id="9"> + <description>Check for updates</description> + <include>ButtonCommonValues</include> + <label>24034</label> + </control> <include>CommonNowPlaying_Controls</include> </control> </control> diff --git a/addons/skin.confluence/addon.xml b/addons/skin.confluence/addon.xml index 80873f7e4e..fb88fdd766 100644 --- a/addons/skin.confluence/addon.xml +++ b/addons/skin.confluence/addon.xml @@ -5,7 +5,7 @@ name="Confluence" provider-name="Jezz_X, Team Kodi"> <requires> - <import addon="xbmc.gui" version="5.8.0"/> + <import addon="xbmc.gui" version="5.9.0"/> </requires> <extension point="xbmc.gui.skin" diff --git a/addons/xbmc.gui/addon.xml b/addons/xbmc.gui/addon.xml index 33c2debf36..cac1b871c6 100644 --- a/addons/xbmc.gui/addon.xml +++ b/addons/xbmc.gui/addon.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<addon id="xbmc.gui" version="5.8.0" provider-name="Team-Kodi"> +<addon id="xbmc.gui" version="5.9.0" provider-name="Team-Kodi"> <backwards-compatibility abi="5.3.0"/> <requires> <import addon="xbmc.core" version="0.1.0"/> diff --git a/xbmc/addons/GUIWindowAddonBrowser.cpp b/xbmc/addons/GUIWindowAddonBrowser.cpp index 59a1dd8184..459e6f8680 100644 --- a/xbmc/addons/GUIWindowAddonBrowser.cpp +++ b/xbmc/addons/GUIWindowAddonBrowser.cpp @@ -54,6 +54,7 @@ #define CONTROL_SHUTUP 6 #define CONTROL_FOREIGNFILTER 7 #define CONTROL_BROKENFILTER 8 +#define CONTROL_CHECK_FOR_UPDATES 9 using namespace ADDON; using namespace XFILE; @@ -120,6 +121,11 @@ bool CGUIWindowAddonBrowser::OnMessage(CGUIMessage& message) Refresh(); return true; } + else if (iControl == CONTROL_CHECK_FOR_UPDATES) + { + CAddonInstaller::Get().UpdateRepos(true); + return true; + } else if (m_viewControl.HasControl(iControl)) // list/thumb control { // get selected item @@ -164,65 +170,31 @@ void CGUIWindowAddonBrowser::GetContextButtons(int itemNumber, CContextButtons& return; CFileItemPtr pItem = m_vecItems->Get(itemNumber); - if (!pItem->IsPath("addons://enabled/")) - buttons.Add(CONTEXT_BUTTON_SCAN,24034); - - AddonPtr addon; - if (!CAddonMgr::Get().GetAddon(pItem->GetProperty("Addon.ID").asString(), addon, ADDON_UNKNOWN, false)) // allow disabled addons - return; - - if (addon->Type() == ADDON_REPOSITORY && pItem->m_bIsFolder) + std::string addonId = pItem->GetProperty("Addon.ID").asString(); + if (!addonId.empty()) { - buttons.Add(CONTEXT_BUTTON_SCAN,24034); - buttons.Add(CONTEXT_BUTTON_REFRESH,24035); - } + buttons.Add(CONTEXT_BUTTON_INFO, 24003); - buttons.Add(CONTEXT_BUTTON_INFO,24003); - - if (addon->HasSettings()) - buttons.Add(CONTEXT_BUTTON_SETTINGS,24020); + AddonPtr addon; + if (CAddonMgr::Get().GetAddon(addonId, addon, ADDON_UNKNOWN, false) && addon->HasSettings()) + buttons.Add(CONTEXT_BUTTON_SETTINGS, 24020); + } CContextMenuManager::Get().AddVisibleItems(pItem, buttons); } -bool CGUIWindowAddonBrowser::OnContextButton(int itemNumber, - CONTEXT_BUTTON button) +bool CGUIWindowAddonBrowser::OnContextButton(int itemNumber, CONTEXT_BUTTON button) { CFileItemPtr pItem = m_vecItems->Get(itemNumber); - if (pItem->IsPath("addons://enabled/")) - { - if (button == CONTEXT_BUTTON_SCAN) - { - CAddonMgr::Get().FindAddons(); - return true; - } - } + std::string addonId = pItem->GetProperty("Addon.ID").asString(); AddonPtr addon; - if (CAddonMgr::Get().GetAddon(pItem->GetProperty("Addon.ID").asString(), addon, ADDON_UNKNOWN, false)) + if (!addonId.empty() && CAddonMgr::Get().GetAddon(addonId, addon, ADDON_UNKNOWN, false)) { if (button == CONTEXT_BUTTON_SETTINGS) return CGUIDialogAddonSettings::ShowAndGetInput(addon); - - if (button == CONTEXT_BUTTON_REFRESH) - { - CAddonDatabase database; - database.Open(); - database.DeleteRepository(addon->ID()); - button = CONTEXT_BUTTON_SCAN; - } - - if (button == CONTEXT_BUTTON_SCAN) - { - CAddonInstaller::Get().UpdateRepos(true); - return true; - } - if (button == CONTEXT_BUTTON_INFO) - { - CGUIDialogAddonInfo::ShowForItem(pItem); - return true; - } + return CGUIDialogAddonInfo::ShowForItem(pItem); } return CGUIMediaWindow::OnContextButton(itemNumber, button); @@ -330,6 +302,7 @@ void CGUIWindowAddonBrowser::UpdateButtons() SET_CONTROL_SELECTED(GetID(),CONTROL_SHUTUP, CSettings::Get().GetBool("general.addonnotifications")); SET_CONTROL_SELECTED(GetID(),CONTROL_FOREIGNFILTER, CSettings::Get().GetBool("general.addonforeignfilter")); SET_CONTROL_SELECTED(GetID(),CONTROL_BROKENFILTER, CSettings::Get().GetBool("general.addonbrokenfilter")); + CONTROL_ENABLE(CONTROL_CHECK_FOR_UPDATES); CGUIMediaWindow::UpdateButtons(); } |