diff options
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | data/Makefile.am | 4 | ||||
-rw-r--r-- | data/epiphany-extension.xsd | 78 | ||||
-rw-r--r-- | src/ephy-extensions-manager.c | 100 |
4 files changed, 13 insertions, 181 deletions
@@ -1,3 +1,15 @@ +2005-09-23 Christian Persch <chpe@cvs.gnome.org> + + * data/Makefile.am: + R data/epiphany-extension.xsd: + * src/ephy-extensions-manager.c: + (ephy_extensions_manager_load_xml_string), + (ephy_extensions_manager_startup), + (ephy_extensions_manager_finalize): + + Since the .xml format is deprecated, remove the (already #if 0'd) + schema validation code. + 2005-09-23 Crispin Flowerday <gnome@flowerday.cx> * data/epiphany.m4: Really add the file diff --git a/data/Makefile.am b/data/Makefile.am index d24827a59..039aa59a6 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -42,9 +42,6 @@ schemadir = $(GCONF_SCHEMA_FILE_DIR) schema_in_files = epiphany.schemas.in epiphany-lockdown.schemas.in schema_DATA = epiphany.schemas epiphany-lockdown.schemas -extensionschemadir = $(pkgdatadir) -extensionschema_DATA = epiphany-extension.xsd - aboutdir = $(pkgdatadir) about_DATA = epiphany.xhtml @@ -76,7 +73,6 @@ EXTRA_DIST = \ $(about_DATA) \ $(applications_DATA) \ $(mimepermission_DATA) \ - $(extensionschema_DATA) \ $(pkgconfig_DATA) \ $(default_prefs_in_FILES) \ $(xsl_DATA) \ diff --git a/data/epiphany-extension.xsd b/data/epiphany-extension.xsd deleted file mode 100644 index 63272a79f..000000000 --- a/data/epiphany-extension.xsd +++ /dev/null @@ -1,78 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <xsd:annotation> - <xsd:documentation xml:lang="en"> - Epiphany Web Browser extension metadata schema. - Copyright (c) 2004 Adam Hooper - </xsd:documentation> - </xsd:annotation> - - <xsd:element name="extension" type="ExtensionType"/> - - <xsd:complexType name="ExtensionType"> - <xsd:annotation> - <xsd:documentation xml:lang="en"> - Metadata about an extension. Note: the elements - must appear *in order* (unfortunately). - </xsd:documentation> - </xsd:annotation> - <xsd:sequence> - <xsd:element name="name" type="xsd:string"/> - <xsd:element name="description" type="xsd:string"/> - <xsd:element name="author" type="AuthorType" - maxOccurs="unbounded"/> - <xsd:element name="url" type="xsd:anyURI" - minOccurs="0"/> - <xsd:element name="version" - type="ExtensionVersionType"/> - <xsd:element name="gettext-domain" type="xsd:string"/> - <xsd:element name="locale-directory" type="xsd:string"/> - <xsd:element name="loader" type="LoaderType"/> - </xsd:sequence> - </xsd:complexType> - - <xsd:simpleType name="ExtensionVersionType"> - <xsd:annotation> - <xsd:documentation xml:lang="en"> - The version of the extension's API. For most - extensions, this number will remain at - "1" indefinitely. The only reason to - increase it would be if any GObject classes - within the extension change parents. - </xsd:documentation> - </xsd:annotation> - <xsd:restriction base="xsd:positiveInteger"/> - </xsd:simpleType> - - <xsd:simpleType name="AuthorType"> - <xsd:annotation> - <xsd:documentation xml:lang="en"> - An extension author -- a name and (optionally) - an email address. - </xsd:documentation> - </xsd:annotation> - <xsd:restriction base="xsd:string"/> - </xsd:simpleType> - - <xsd:complexType name="LoaderType"> - <xsd:annotation> - <xsd:documentation xml:lang="en"> - The type of loader to use for the extension. - For example, "shlib". - </xsd:documentation> - </xsd:annotation> - <xsd:sequence> - <xsd:element name="attribute" maxOccurs="unbounded"> - <xsd:complexType> - <xsd:simpleContent> - <xsd:extension base="xsd:string"> - <xsd:attribute name="name" type="xsd:ID"/> - </xsd:extension> - </xsd:simpleContent> - </xsd:complexType> - </xsd:element> - </xsd:sequence> - <xsd:attribute name="type" type="xsd:ID" use="required"/> - </xsd:complexType> - -</xsd:schema> diff --git a/src/ephy-extensions-manager.c b/src/ephy-extensions-manager.c index 8f01e4f2b..661889e54 100644 --- a/src/ephy-extensions-manager.c +++ b/src/ephy-extensions-manager.c @@ -47,13 +47,6 @@ #include <dirent.h> #include <string.h> -/* define to validate the extensions files */ -/* #define ENABLE_VALIDATION */ - -#ifdef ENABLE_VALIDATION -#include <libxml/xmlschemas.h> -#endif - #ifdef ENABLE_PYTHON #include "ephy-python-extension.h" #include "ephy-python-loader.h" @@ -74,11 +67,6 @@ struct _EphyExtensionsManagerPrivate GList *dir_monitors; GList *windows; guint active_extensions_notifier_id; - -#ifdef ENABLE_VALIDATION - xmlSchemaPtr schema; - xmlSchemaValidCtxtPtr schema_ctxt; -#endif }; typedef struct @@ -400,19 +388,7 @@ ephy_extensions_manager_load_xml_string (EphyExtensionsManager *manager, g_warning ("Couldn't read '%s' data\n", identifier); return; } -#ifdef ENABLE_VALIDATION - /* Validate the extension description */ - if (manager->priv->schema_ctxt) - { - if (xmlSchemaValidateDoc (manager->priv->schema_ctxt, doc)) - { - g_warning ("Validation errors in '%s' data", - identifier); - xmlFreeDoc (doc); - return; - } - } -#endif + /* Now parse it */ reader = xmlReaderWalker (doc); g_return_if_fail (reader != NULL); @@ -1347,65 +1323,6 @@ active_extensions_notifier (GConfClient *client, sync_loaded_extensions (manager); } -#ifdef ENABLE_VALIDATION -static void -xml_error_cb (EphyExtensionsManager *manager, - const char *msg, - ...) - -{ - va_list args; - - va_start (args, msg); - g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, msg, args); - va_end(args); -} - -static void -init_schema_ctxt (EphyExtensionsManager *manager) -{ - xmlSchemaParserCtxtPtr parse_ctxt; - const char *filename; - - manager->priv->schema = NULL; - manager->priv->schema_ctxt = NULL; - - filename = ephy_file (SCHEMA_FILE); - g_return_if_fail (filename != NULL); - - parse_ctxt = xmlSchemaNewParserCtxt (filename); - if (parse_ctxt == NULL) - { - g_warning ("Error opening extensions description schema file " - "\"" SCHEMA_FILE "\""); - return; - } - - manager->priv->schema = xmlSchemaParse (parse_ctxt); - xmlSchemaFreeParserCtxt (parse_ctxt); - if (manager->priv->schema == NULL) - { - g_warning ("Error parsing extensions description schema file " - "\"" SCHEMA_FILE "\""); - return; - } - - manager->priv->schema_ctxt = xmlSchemaNewValidCtxt - (manager->priv->schema); - if (manager->priv->schema == NULL) - { - g_warning ("Error creating extensions description schema " - "validation context for \"" SCHEMA_FILE "\""); - return; - } - - xmlSchemaSetValidErrors (manager->priv->schema_ctxt, - (xmlSchemaValidityErrorFunc) xml_error_cb, - (xmlSchemaValidityWarningFunc) xml_error_cb, - manager); -} -#endif - static void ephy_extensions_manager_init (EphyExtensionsManager *manager) { @@ -1423,10 +1340,6 @@ ephy_extensions_manager_startup (EphyExtensionsManager *manager) LOG ("EphyExtensionsManager startup"); -#ifdef ENABLE_VALIDATION - init_schema_ctxt (manager); -#endif - /* load the extensions descriptions */ path = g_build_filename (ephy_dot_dir (), "extensions", NULL); ephy_extensions_manager_load_dir (manager, path); @@ -1467,17 +1380,6 @@ ephy_extensions_manager_finalize (GObject *object) g_list_free (priv->windows); -#ifdef ENABLE_VALIDATION - if (priv->schema) - { - xmlSchemaFree (priv->schema); - } - if (priv->schema_ctxt) - { - xmlSchemaFreeValidCtxt (priv->schema_ctxt); - } -#endif - parent_class->finalize (object); } |