diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2003-09-18 06:04:47 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2003-09-18 06:04:47 +0800 |
commit | 6d93635b94a93ff3188e88a46393083fbca7e603 (patch) | |
tree | ec38e729d6ce9251ad0ce2f737168e483ff979d9 /embed | |
parent | ff09416c7a185b6774c5f1e04c9673c9f0d86f71 (diff) | |
download | gsoc2013-epiphany-6d93635b94a93ff3188e88a46393083fbca7e603.tar gsoc2013-epiphany-6d93635b94a93ff3188e88a46393083fbca7e603.tar.gz gsoc2013-epiphany-6d93635b94a93ff3188e88a46393083fbca7e603.tar.bz2 gsoc2013-epiphany-6d93635b94a93ff3188e88a46393083fbca7e603.tar.lz gsoc2013-epiphany-6d93635b94a93ff3188e88a46393083fbca7e603.tar.xz gsoc2013-epiphany-6d93635b94a93ff3188e88a46393083fbca7e603.tar.zst gsoc2013-epiphany-6d93635b94a93ff3188e88a46393083fbca7e603.zip |
Refactor node db loading functions into a common one in ephy-node-db.
2003-09-18 Christian Persch <chpe@cvs.gnome.org>
* embed/ephy-favicon-cache.c: (ephy_favicon_cache_init):
* embed/ephy-history.c: (ephy_history_init):
* lib/ephy-node-db.c: (ephy_node_db_load_from_file):
* lib/ephy-node-db.h:
* lib/ephy-state.c: (ensure_states):
* src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_init):
Refactor node db loading functions into a common one in
ephy-node-db. Switch to using xmlReader api.
Diffstat (limited to 'embed')
-rw-r--r-- | embed/ephy-favicon-cache.c | 29 | ||||
-rw-r--r-- | embed/ephy-history.c | 29 |
2 files changed, 8 insertions, 50 deletions
diff --git a/embed/ephy-favicon-cache.c b/embed/ephy-favicon-cache.c index 3c4bc6654..727094f6d 100644 --- a/embed/ephy-favicon-cache.c +++ b/embed/ephy-favicon-cache.c @@ -31,6 +31,7 @@ #include "ephy-node.h" #include "ephy-debug.h" +#define EPHY_FAVICON_CACHE_XML_ROOT "ephy_favicons_cache" #define EPHY_FAVICON_CACHE_XML_VERSION "1.0" #define EPHY_FAVICON_CACHE_OBSOLETE_DAYS 30 @@ -123,30 +124,6 @@ ephy_favicon_cache_new (void) return cache; } -static void -ephy_favicon_cache_load (EphyFaviconCache *eb) -{ - xmlDocPtr doc; - xmlNodePtr root, child; - - if (g_file_test (eb->priv->xml_file, G_FILE_TEST_EXISTS) == FALSE) - return; - - doc = xmlParseFile (eb->priv->xml_file); - g_assert (doc != NULL); - - root = xmlDocGetRootElement (doc); - - for (child = root->children; child != NULL; child = child->next) - { - EphyNode *node; - - node = ephy_node_new_from_xml (eb->priv->db, child); - } - - xmlFreeDoc (doc); -} - static gboolean icon_is_obsolete (EphyNode *node, GDate *now) { @@ -304,7 +281,9 @@ ephy_favicon_cache_init (EphyFaviconCache *cache) (EphyNodeCallback) icons_removed_cb, G_OBJECT (cache)); - ephy_favicon_cache_load (cache); + ephy_node_db_load_from_file (cache->priv->db, cache->priv->xml_file, + EPHY_FAVICON_CACHE_XML_ROOT, + EPHY_FAVICON_CACHE_XML_VERSION); } static gboolean diff --git a/embed/ephy-history.c b/embed/ephy-history.c index 3a00a9c98..a0e6a6626 100644 --- a/embed/ephy-history.c +++ b/embed/ephy-history.c @@ -34,6 +34,7 @@ #include <bonobo/bonobo-i18n.h> #include <libgnomevfs/gnome-vfs-uri.h> +#define EPHY_HISTORY_XML_ROOT "ephy_history" #define EPHY_HISTORY_XML_VERSION "1.0" /* how often to save the history, in milliseconds */ @@ -202,30 +203,6 @@ ephy_history_class_init (EphyHistoryClass *klass) g_type_class_add_private (object_class, sizeof(EphyHistoryPrivate)); } -static void -ephy_history_load (EphyHistory *eb) -{ - xmlDocPtr doc; - xmlNodePtr root, child; - - if (g_file_test (eb->priv->xml_file, G_FILE_TEST_EXISTS) == FALSE) - return; - - doc = xmlParseFile (eb->priv->xml_file); - g_return_if_fail (doc != NULL); - - root = xmlDocGetRootElement (doc); - - for (child = root->children; child != NULL; child = child->next) - { - EphyNode *node; - - node = ephy_node_new_from_xml (eb->priv->db, child); - } - - xmlFreeDoc (doc); -} - static gboolean page_is_obsolete (EphyNode *node, GDate *now) { @@ -478,7 +455,9 @@ ephy_history_init (EphyHistory *eb) ephy_node_add_child (eb->priv->hosts, eb->priv->pages); - ephy_history_load (eb); + ephy_node_db_load_from_file (eb->priv->db, eb->priv->xml_file, + EPHY_HISTORY_XML_ROOT, + EPHY_HISTORY_XML_VERSION); ephy_history_emit_data_changed (eb); g_hash_table_foreach (eb->priv->hosts_hash, |