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 /src/bookmarks/ephy-bookmarks.c | |
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 'src/bookmarks/ephy-bookmarks.c')
-rw-r--r-- | src/bookmarks/ephy-bookmarks.c | 48 |
1 files changed, 6 insertions, 42 deletions
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c index bf1d575d2..0c05e59c7 100644 --- a/src/bookmarks/ephy-bookmarks.c +++ b/src/bookmarks/ephy-bookmarks.c @@ -39,6 +39,7 @@ #include <bonobo/bonobo-i18n.h> #include <libgnomevfs/gnome-vfs-utils.h> +#define EPHY_BOOKMARKS_XML_ROOT "ephy_bookmarks" #define EPHY_BOOKMARKS_XML_VERSION "1.0" #define BOOKMARKS_SAVE_DELAY (3 * 1000) #define MAX_FAVORITES_NUM 10 @@ -311,45 +312,6 @@ ephy_bookmarks_class_init (EphyBookmarksClass *klass) g_type_class_add_private (object_class, sizeof(EphyBookmarksPrivate)); } -static gboolean -ephy_bookmarks_load (EphyBookmarks *eb) -{ - xmlDocPtr doc; - xmlNodePtr root, child; - char *tmp; - gboolean result = TRUE; - - if (g_file_test (eb->priv->xml_file, G_FILE_TEST_EXISTS) == FALSE) - return FALSE; - - doc = xmlParseFile (eb->priv->xml_file); - g_return_val_if_fail (doc != NULL, FALSE); - - root = xmlDocGetRootElement (doc); - child = root->children; - - tmp = xmlGetProp (root, "version"); - if (tmp != NULL && strcmp (tmp, EPHY_BOOKMARKS_XML_VERSION) != 0) - { - g_warning ("Old bookmarks database format detected"); - - child = NULL; - result = FALSE; - } - g_free (tmp); - - for (; child != NULL; child = child->next) - { - EphyNode *node; - - node = ephy_node_new_from_xml (eb->priv->db, child); - } - - xmlFreeDoc (doc); - - return result; -} - static void ephy_bookmarks_save (EphyBookmarks *eb) { @@ -753,11 +715,13 @@ ephy_bookmarks_init (EphyBookmarks *eb) g_value_unset (&value); ephy_node_add_child (eb->priv->keywords, eb->priv->notcategorized); - if (!ephy_bookmarks_load (eb)) + if (ephy_node_db_load_from_file (eb->priv->db, eb->priv->xml_file, + EPHY_BOOKMARKS_XML_ROOT, + EPHY_BOOKMARKS_XML_VERSION) == FALSE) { - if (!ephy_bookmarks_import_rdf (eb, eb->priv->rdf_file)) + if (ephy_bookmarks_import_rdf (eb, eb->priv->rdf_file) == FALSE) { - eb->priv->init_defaults = !ephy_bookmarks_load (eb); + eb->priv->init_defaults = TRUE; } } |