Skip to content
This repository has been archived by the owner on Apr 15, 2023. It is now read-only.

Commit

Permalink
added: ticket xbmc#9633 - "addons://outdated/" for listing all Add-on…
Browse files Browse the repository at this point in the history
…s with updates available. thanks to montellese

git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@31878 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
  • Loading branch information
spiff_ committed Jul 17, 2010
1 parent 2359861 commit e21982b
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions language/English/strings.xml
Expand Up @@ -2179,6 +2179,7 @@
<string id="24040">(Clear the current setting)</string>
<string id="24041">Install from zip file</string>
<string id="24042">Downloading %i%%</string>
<string id="24043">Outdated Add-ons</string>

<string id="24050">Available Add-ons</string>
<string id="24051">Version:</string>
Expand Down
4 changes: 4 additions & 0 deletions xbmc/FileSystem/AddonsDirectory.cpp
Expand Up @@ -58,6 +58,10 @@ bool CAddonsDirectory::GetDirectory(const CStdString& strPath, CFileItemList &it
CAddonMgr::Get().GetAllAddons(addons, path.GetHostName().Equals("enabled"));
items.SetProperty("reponame",g_localizeStrings.Get(24062));
}
else if (path.GetHostName().Equals("outdated"))
{
CAddonMgr::Get().GetAllOutdatedAddons(addons);
}
else if (path.GetHostName().Equals("repos"))
{
CAddonMgr::Get().GetAddons(ADDON_REPOSITORY,addons,true);
Expand Down
9 changes: 9 additions & 0 deletions xbmc/GUIViewStateAddonBrowser.cpp
Expand Up @@ -78,6 +78,15 @@ VECSOURCES& CGUIViewStateAddonBrowser::GetSources()
share.m_strThumbnailImage = "DefaultHardDisk.png";
m_sources.push_back(share);
}
if (CAddonMgr::Get().HasOutdatedAddons())
{
CMediaSource share;
share.strPath = "addons://outdated/";
share.m_iDriveType = CMediaSource::SOURCE_TYPE_LOCAL;
share.strName = g_localizeStrings.Get(24043);
share.m_strThumbnailImage = "DefaultHardDisk.png";
m_sources.push_back(share);
}
if (CAddonMgr::Get().HasAddons(ADDON_REPOSITORY,true))
{
CMediaSource share;
Expand Down
28 changes: 28 additions & 0 deletions xbmc/addons/AddonManager.cpp
Expand Up @@ -290,6 +290,34 @@ bool CAddonMgr::GetAllAddons(VECADDONS &addons, bool enabled /*= true*/)
return !addons.empty();
}

bool CAddonMgr::GetAllOutdatedAddons(VECADDONS &addons, bool enabled /*= true*/)
{
CSingleLock lock(m_critSection);
for (int i = ADDON_UNKNOWN+1; i < ADDON_VIZ_LIBRARY; ++i)
{
VECADDONS temp;
if (CAddonMgr::Get().GetAddons((TYPE)i, temp, enabled))
{
AddonPtr repoAddon;
for (unsigned int j = 0; j < temp.size(); j++)
{
if (!m_database.GetAddon(temp[j]->ID(), repoAddon))
continue;

if (temp[j]->Version() < repoAddon->Version())
addons.push_back(repoAddon);
}
}
}
return !addons.empty();
}

bool CAddonMgr::HasOutdatedAddons(bool enabled /*= true*/)
{
VECADDONS dummy;
return GetAllOutdatedAddons(dummy,enabled);
}

bool CAddonMgr::GetAddons(const TYPE &type, VECADDONS &addons, bool enabled /* = true */)
{
CSingleLock lock(m_critSection);
Expand Down
11 changes: 11 additions & 0 deletions xbmc/addons/AddonManager.h
Expand Up @@ -90,6 +90,17 @@ namespace ADDON
bool HasAddons(const TYPE &type, bool enabled = true);
bool GetAddons(const TYPE &type, VECADDONS &addons, bool enabled = true);
bool GetAllAddons(VECADDONS &addons, bool enabled = true);
/*! \brief Get all addons with available updates
\param addons List to fill with all outdated addons
\param enabled Whether to get only enabled or disabled addons
\return True if there are outdated addons otherwise false
*/
bool GetAllOutdatedAddons(VECADDONS &addons, bool enabled = true);
/*! \brief Checks if there is any addon with available updates
\param enabled Whether to check only enabled or disabled addons
\return True if there are outdated addons otherwise false
*/
bool HasOutdatedAddons(bool enabled = true);
CStdString GetString(const CStdString &id, const int number);

const char *GetTranslatedString(const cp_cfg_element_t *root, const char *tag);
Expand Down

0 comments on commit e21982b

Please sign in to comment.