Permalink
Browse files

allow addons with no extensions to be returned for dependency checking

  • Loading branch information...
1 parent ca950ee commit 46bdb1750510a74c54fd27a9d97c873b154c3196 Jonathan Marshall committed Mar 10, 2011
Showing with 31 additions and 1 deletion.
  1. +23 −0 xbmc/addons/Addon.cpp
  2. +2 −0 xbmc/addons/Addon.h
  3. +6 −1 xbmc/addons/AddonManager.cpp
View
@@ -273,6 +273,17 @@ AddonProps::AddonProps(const cp_extension_t *ext)
BuildDependencies(ext->plugin);
}
+AddonProps::AddonProps(const cp_plugin_info_t *plugin)
+ : id(plugin->identifier)
+ , version(plugin->version)
+ , name(plugin->name)
+ , path(plugin->plugin_path)
+ , author(plugin->provider_name)
+ , stars(0)
+{
+ BuildDependencies(plugin);
+}
+
void AddonProps::BuildDependencies(const cp_plugin_info_t *plugin)
{
if (!plugin)
@@ -304,6 +315,18 @@ CAddon::CAddon(const cp_extension_t *ext)
m_userSettingsLoaded = false;
}
+CAddon::CAddon(const cp_plugin_info_t *plugin)
+ : m_props(plugin)
+ , m_parent(AddonPtr())
+{
+ m_enabled = true;
+ m_hasSettings = false;
+ m_hasStrings = false;
+ m_checkedStrings = true;
+ m_settingsLoaded = false;
+ m_userSettingsLoaded = false;
+}
+
CAddon::CAddon(const AddonProps &props)
: m_props(props)
, m_parent(AddonPtr())
View
@@ -71,6 +71,7 @@ class AddonProps
}
AddonProps(const cp_extension_t *ext);
+ AddonProps(const cp_plugin_info_t *plugin);
bool operator==(const AddonProps &rhs)
{
@@ -110,6 +111,7 @@ class CAddon : public IAddon
public:
CAddon(const AddonProps &addonprops);
CAddon(const cp_extension_t *ext);
+ CAddon(const cp_plugin_info_t *plugin);
virtual ~CAddon() {}
virtual AddonPtr Clone(const AddonPtr& parent) const;
@@ -624,9 +624,14 @@ bool CAddonMgr::GetExtList(cp_cfg_element_t *base, const char *path, vector<CStd
AddonPtr CAddonMgr::GetAddonFromDescriptor(const cp_plugin_info_t *info)
{
- if (!info || !info->extensions)
+ if (!info)
return AddonPtr();
+ if (!info->extensions)
+ { // no extensions, so we need only the dep information
+ return AddonPtr(new CAddon(info));
+ }
+
// FIXME: If we want to support multiple extension points per addon, we'll need to extend this to not just take
// the first extension point (eg use the TYPE information we pass in)

0 comments on commit 46bdb17

Please sign in to comment.