diff options
author | alcoheca <alcoheca@svn> | 2010-03-26 13:55:28 +0000 |
---|---|---|
committer | alcoheca <alcoheca@svn> | 2010-03-26 13:55:28 +0000 |
commit | 4e2beb6919e96cbe4a63e8695aa79ec87905c272 (patch) | |
tree | b65c21c57521312350a01f945b6e36cf7e3cf0f6 /lib/cpluff | |
parent | b632a42d5cacdda7bb07a3fee995a4f0de1deba9 (diff) |
changed: modified cpluff to externally describe plugins as addons
added: mandatory summary field to cp_plugin_t
changed: make version a required property
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@28835 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'lib/cpluff')
-rw-r--r-- | lib/cpluff/libcpluff/cpluff.h | 7 | ||||
-rw-r--r-- | lib/cpluff/libcpluff/pcontrol.c | 1 | ||||
-rw-r--r-- | lib/cpluff/libcpluff/ploader.c | 18 |
3 files changed, 19 insertions, 7 deletions
diff --git a/lib/cpluff/libcpluff/cpluff.h b/lib/cpluff/libcpluff/cpluff.h index 0f9797d37a..27ee7162de 100644 --- a/lib/cpluff/libcpluff/cpluff.h +++ b/lib/cpluff/libcpluff/cpluff.h @@ -405,6 +405,13 @@ struct cp_plugin_info_t { char *identifier; /** + * A mandatory summary of the addon's features. + * This corresponds to the @a summary attribute of the @a plugin element in + * a plug-in descriptor. + */ + char *summary; + + /** * An optional plug-in name. NULL if not available. The plug-in name is * intended only for display purposes and the value can be localized. * This corresponds to the @a name attribute of the @a plugin element in diff --git a/lib/cpluff/libcpluff/pcontrol.c b/lib/cpluff/libcpluff/pcontrol.c index 83a24cbf2c..c5a3310a0d 100644 --- a/lib/cpluff/libcpluff/pcontrol.c +++ b/lib/cpluff/libcpluff/pcontrol.c @@ -1109,6 +1109,7 @@ CP_HIDDEN void cpi_free_plugin(cp_plugin_info_t *plugin) { assert(plugin != NULL); free(plugin->name); + free(plugin->summary); free(plugin->identifier); free(plugin->version); free(plugin->provider_name); diff --git a/lib/cpluff/libcpluff/ploader.c b/lib/cpluff/libcpluff/ploader.c index 648c2bb326..d6ea187d99 100644 --- a/lib/cpluff/libcpluff/ploader.c +++ b/lib/cpluff/libcpluff/ploader.c @@ -57,7 +57,7 @@ #define CP_CFG_ELEMENT_VALUE_INITSIZE 64 /// Plugin descriptor name -#define CP_PLUGIN_DESCRIPTOR "plugin.xml" +#define CP_PLUGIN_DESCRIPTOR "addon.xml" /* ------------------------------------------------------------------------ @@ -514,13 +514,13 @@ static void CP_XMLCALL character_data_handler( */ static void CP_XMLCALL start_element_handler( void *userData, const XML_Char *name, const XML_Char **atts) { - static const XML_Char * const req_plugin_atts[] = { "id", NULL }; - static const XML_Char * const opt_plugin_atts[] = { "name", "version", "provider-name", NULL }; + static const XML_Char * const req_plugin_atts[] = { "id", "summary", "version", NULL }; + static const XML_Char * const opt_plugin_atts[] = { "name", "provider-name", NULL }; static const XML_Char * const req_bwcompatibility_atts[] = { NULL }; static const XML_Char * const opt_bwcompatibility_atts[] = { "abi", "api", NULL }; static const XML_Char * const req_cpluff_atts[] = { "version", NULL }; static const XML_Char * const opt_cpluff_atts[] = { NULL }; - static const XML_Char * const req_import_atts[] = { "plugin", NULL }; + static const XML_Char * const req_import_atts[] = { "addon", NULL }; static const XML_Char * const opt_import_atts[] = { "version", "optional", NULL }; static const XML_Char * const req_runtime_atts[] = { "library", NULL }; static const XML_Char * const opt_runtime_atts[] = { "funcs", NULL }; @@ -535,7 +535,7 @@ static void CP_XMLCALL start_element_handler( switch (plcontext->state) { case PARSER_BEGIN: - if (!strcmp(name, "plugin")) { + if (!strcmp(name, "addon")) { plcontext->state = PARSER_PLUGIN; if (!check_attributes(plcontext, name, atts, req_plugin_atts, opt_plugin_atts)) { @@ -548,6 +548,9 @@ static void CP_XMLCALL start_element_handler( } else if (!strcmp(atts[i], "id")) { plcontext->plugin->identifier = parser_strdup(plcontext, atts[i+1]); + } else if (!strcmp(atts[i], "summary")) { + plcontext->plugin->summary + = parser_strdup(plcontext, atts[i+1]); } else if (!strcmp(atts[i], "version")) { plcontext->plugin->version = parser_strdup(plcontext, atts[i+1]); @@ -745,7 +748,7 @@ static void CP_XMLCALL start_element_handler( import->plugin_id = NULL; import->version = NULL; for (i = 0; atts[i] != NULL; i += 2) { - if (!strcmp(atts[i], "plugin")) { + if (!strcmp(atts[i], "addon")) { import->plugin_id = parser_strdup(plcontext, atts[i+1]); } else if (!strcmp(atts[i], "version")) { @@ -828,7 +831,7 @@ static void CP_XMLCALL end_element_handler( switch (plcontext->state) { case PARSER_PLUGIN: - if (!strcmp(name, "plugin")) { + if (!strcmp(name, "addon")) { // Readjust memory allocated for extension points, if necessary if (plcontext->ext_points_size != plcontext->plugin->num_ext_points) { @@ -1043,6 +1046,7 @@ CP_C_API cp_plugin_info_t * cp_load_plugin_descriptor(cp_context_t *context, con plcontext->state = PARSER_BEGIN; memset(plcontext->plugin, 0, sizeof(cp_plugin_info_t)); plcontext->plugin->name = NULL; + plcontext->plugin->summary = NULL; plcontext->plugin->identifier = NULL; plcontext->plugin->version = NULL; plcontext->plugin->provider_name = NULL; |