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

Commit

Permalink
allow addons with no extensions to be returned for dependency checking
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Marshall committed Mar 10, 2011
1 parent ca950ee commit 46bdb17
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
23 changes: 23 additions & 0 deletions xbmc/addons/Addon.cpp
Expand Up @@ -273,6 +273,17 @@ AddonProps::AddonProps(const cp_extension_t *ext)
BuildDependencies(ext->plugin); 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) void AddonProps::BuildDependencies(const cp_plugin_info_t *plugin)
{ {
if (!plugin) if (!plugin)
Expand Down Expand Up @@ -304,6 +315,18 @@ CAddon::CAddon(const cp_extension_t *ext)
m_userSettingsLoaded = false; 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) CAddon::CAddon(const AddonProps &props)
: m_props(props) : m_props(props)
, m_parent(AddonPtr()) , m_parent(AddonPtr())
Expand Down
2 changes: 2 additions & 0 deletions xbmc/addons/Addon.h
Expand Up @@ -71,6 +71,7 @@ class AddonProps
} }


AddonProps(const cp_extension_t *ext); AddonProps(const cp_extension_t *ext);
AddonProps(const cp_plugin_info_t *plugin);


bool operator==(const AddonProps &rhs) bool operator==(const AddonProps &rhs)
{ {
Expand Down Expand Up @@ -110,6 +111,7 @@ class CAddon : public IAddon
public: public:
CAddon(const AddonProps &addonprops); CAddon(const AddonProps &addonprops);
CAddon(const cp_extension_t *ext); CAddon(const cp_extension_t *ext);
CAddon(const cp_plugin_info_t *plugin);
virtual ~CAddon() {} virtual ~CAddon() {}
virtual AddonPtr Clone(const AddonPtr& parent) const; virtual AddonPtr Clone(const AddonPtr& parent) const;


Expand Down
7 changes: 6 additions & 1 deletion xbmc/addons/AddonManager.cpp
Expand Up @@ -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) AddonPtr CAddonMgr::GetAddonFromDescriptor(const cp_plugin_info_t *info)
{ {
if (!info || !info->extensions) if (!info)
return AddonPtr(); 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 // 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) // the first extension point (eg use the TYPE information we pass in)


Expand Down

0 comments on commit 46bdb17

Please sign in to comment.