diff options
author | Kai Sommerfeld <kai.sommerfeld@gmx.com> | 2019-09-01 11:36:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-01 11:36:07 +0200 |
commit | ebafa3edd042004941dd80e4e634ec3312d50d1a (patch) | |
tree | a6ccca76b2267a693891235cc1b96f73f7befdb6 | |
parent | 05a2c2879810a9b8a375d31e9922300883104929 (diff) | |
parent | 80061becfb10e17db05dc40914bee18b810ac70b (diff) |
Merge pull request #16551 from ksooo/listprovider-react-on-repo-updated
[listproviders] Update addons list on repository updated
-rw-r--r-- | xbmc/listproviders/DirectoryProvider.cpp | 11 | ||||
-rw-r--r-- | xbmc/listproviders/DirectoryProvider.h | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/xbmc/listproviders/DirectoryProvider.cpp b/xbmc/listproviders/DirectoryProvider.cpp index d280adfa7d..2de85b9c75 100644 --- a/xbmc/listproviders/DirectoryProvider.cpp +++ b/xbmc/listproviders/DirectoryProvider.cpp @@ -294,6 +294,15 @@ void CDirectoryProvider::OnAddonEvent(const ADDON::AddonEvent& event) } } +void CDirectoryProvider::OnAddonRepositoryEvent(const ADDON::CRepositoryUpdater::RepositoryUpdated& event) +{ + CSingleLock lock(m_section); + if (URIUtils::IsProtocol(m_currentUrl, "addons")) + { + m_updateState = INVALIDATED; + } +} + void CDirectoryProvider::OnPVRManagerEvent(const PVR::PVREvent& event) { CSingleLock lock(m_section); @@ -337,6 +346,7 @@ void CDirectoryProvider::Reset() m_isAnnounced = false; CServiceBroker::GetAnnouncementManager()->RemoveAnnouncer(this); CServiceBroker::GetFavouritesService().Events().Unsubscribe(this); + CServiceBroker::GetRepositoryUpdater().Events().Unsubscribe(this); CServiceBroker::GetAddonMgr().Events().Unsubscribe(this); CServiceBroker::GetPVRManager().Events().Unsubscribe(this); } @@ -461,6 +471,7 @@ bool CDirectoryProvider::UpdateURL() m_isAnnounced = true; CServiceBroker::GetAnnouncementManager()->AddAnnouncer(this); CServiceBroker::GetAddonMgr().Events().Subscribe(this, &CDirectoryProvider::OnAddonEvent); + CServiceBroker::GetRepositoryUpdater().Events().Subscribe(this, &CDirectoryProvider::OnAddonRepositoryEvent); CServiceBroker::GetPVRManager().Events().Subscribe(this, &CDirectoryProvider::OnPVRManagerEvent); CServiceBroker::GetFavouritesService().Events().Subscribe(this, &CDirectoryProvider::OnFavouritesEvent); } diff --git a/xbmc/listproviders/DirectoryProvider.h b/xbmc/listproviders/DirectoryProvider.h index 962984c93a..f47afc7c72 100644 --- a/xbmc/listproviders/DirectoryProvider.h +++ b/xbmc/listproviders/DirectoryProvider.h @@ -10,6 +10,7 @@ #include "IListProvider.h" #include "addons/AddonEvents.h" +#include "addons/RepositoryUpdater.h" #include "favourites/FavouritesService.h" #include "guilib/GUIStaticItem.h" #include "interfaces/IAnnouncer.h" @@ -84,6 +85,7 @@ private: bool UpdateLimit(); bool UpdateSort(); void OnAddonEvent(const ADDON::AddonEvent& event); + void OnAddonRepositoryEvent(const ADDON::CRepositoryUpdater::RepositoryUpdated& event); void OnPVRManagerEvent(const PVR::PVREvent& event); void OnFavouritesEvent(const CFavouritesService::FavouritesUpdated& event); std::string GetTarget(const CFileItem& item) const; |