From 21fc7031a88fc32183cc4e12c00e8a0768b144f6 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Fri, 23 Sep 2005 21:27:17 +0000 Subject: Don't read unused variables, and use a #define for the keyfile extension. 2005-09-23 Christian Persch * src/epphy-extensions-manager.c: (free_extension_info), (ephy_extensions_manager_load_xml_string), (path_to_identifier), (ephy_extensions_manager_load_file), (load_file_from_monitor), (dir_changed_cb), (ephy_extensions_manager_load_dir): Don't read unused variables, and use a #define for the keyfile extension. --- src/ephy-extensions-manager.c | 48 ++++++++++--------------------------------- 1 file changed, 11 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/ephy-extensions-manager.c b/src/ephy-extensions-manager.c index 661889e54..407660871 100644 --- a/src/ephy-extensions-manager.c +++ b/src/ephy-extensions-manager.c @@ -53,7 +53,7 @@ #endif #define CONF_LOADED_EXTENSIONS "/apps/epiphany/general/active_extensions" -#define SCHEMA_FILE "/epiphany-extension.xsd" +#define DOT_INIT ".ephy-extension" #define EPHY_EXTENSIONS_MANAGER_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_EXTENSIONS_MANAGER, EphyExtensionsManagerPrivate)) @@ -73,11 +73,8 @@ typedef struct { EphyExtensionInfo info; guint version; - gboolean load_deferred; /* NOT USED? */ gboolean load_failed; - char *gettext_domain; /* NOT USED? */ - char *locale_directory; /* NOT USED? */ char *loader_type; GData *loader_attributes; @@ -262,8 +259,6 @@ free_extension_info (ExtensionInfo *info) g_list_foreach (einfo->authors, (GFunc) g_free, NULL); g_list_free (einfo->authors); g_free (einfo->url); - g_free (info->gettext_domain); - g_free (info->locale_directory); g_free (info->loader_type); g_datalist_clear (&info->loader_attributes); @@ -518,33 +513,12 @@ ephy_extensions_manager_load_xml_string (EphyExtensionsManager *manager, { assign_localised_string (reader, &description); } - else if (state == STATE_GETTEXT_DOMAIN && - type == XML_READER_TYPE_TEXT) + else if (type == XML_READER_TYPE_TEXT && + (state == STATE_GETTEXT_DOMAIN || + state == STATE_LOAD_DEFERRED || + state == STATE_LOCALE_DIRECTORY)) { - const xmlChar *attr; - - attr = xmlTextReaderConstValue (reader); - - info->gettext_domain = g_strdup ((char*)attr); - } - else if (state == STATE_LOAD_DEFERRED && - type == XML_READER_TYPE_TEXT) - { - const xmlChar *value; - - value = xmlTextReaderConstValue (reader); - - info->load_deferred = - (value != NULL && xmlStrEqual (value, (const xmlChar *) "true")); - } - else if (state == STATE_LOCALE_DIRECTORY && - type == XML_READER_TYPE_TEXT) - { - const xmlChar *attr; - - attr = xmlTextReaderConstValue (reader); - - info->locale_directory = g_strdup ((char*)attr); + /* not supported anymore */ } else if (state == STATE_NAME && type == XML_READER_TYPE_TEXT) @@ -795,7 +769,7 @@ path_to_identifier (const char *path) char *identifier, *dot; identifier = g_path_get_basename (path); - dot = strstr (identifier, ".ephy-extension"); + dot = strstr (identifier, DOT_INIT); if (!dot) { @@ -830,7 +804,7 @@ ephy_extensions_manager_load_file (EphyExtensionsManager *manager, identifier = path_to_identifier (path); g_return_if_fail (identifier != NULL); - if (g_str_has_suffix (path, ".ephy-extension")) + if (g_str_has_suffix (path, DOT_INIT)) { ephy_extensions_manager_load_ini_string (manager, identifier, contents); @@ -1214,7 +1188,7 @@ load_file_from_monitor (EphyExtensionsManager *manager, return; } - if (g_str_has_suffix (path, ".ephy-extension")) + if (g_str_has_suffix (path, DOT_INIT)) { ephy_extensions_manager_load_ini_string (manager, identifier, contents); @@ -1244,7 +1218,7 @@ dir_changed_cb (GnomeVFSMonitorHandle *handle, * We only deal with XML and INI files: * Add them to the manager when created, remove them when deleted. */ - if (g_str_has_suffix (info_uri, ".ephy-extension") == FALSE && + if (g_str_has_suffix (info_uri, DOT_INIT) == FALSE && g_str_has_suffix (info_uri, ".xml") == FALSE) return; path = gnome_vfs_get_local_path_from_uri (info_uri); @@ -1287,7 +1261,7 @@ ephy_extensions_manager_load_dir (EphyExtensionsManager *manager, } while ((e = readdir (d)) != NULL) { - if (g_str_has_suffix (e->d_name, ".ephy-extension") || + if (g_str_has_suffix (e->d_name, DOT_INIT) || g_str_has_suffix (e->d_name, ".xml")) { file_path = g_build_filename (path, e->d_name, NULL); -- cgit v1.2.3