aboutsummaryrefslogtreecommitdiffstats
path: root/embed/ephy-history.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2003-11-08 20:56:44 +0800
committerChristian Persch <chpe@src.gnome.org>2003-11-08 20:56:44 +0800
commit6b00de66025093218127fa74d9a423d58e377025 (patch)
treef2bee4a1f06f16128aa1a2e64da8023d882e1e58 /embed/ephy-history.c
parent5e5d25f08036ef3f2ac9af3071a36def13f5b2c6 (diff)
downloadgsoc2013-epiphany-6b00de66025093218127fa74d9a423d58e377025.tar
gsoc2013-epiphany-6b00de66025093218127fa74d9a423d58e377025.tar.gz
gsoc2013-epiphany-6b00de66025093218127fa74d9a423d58e377025.tar.bz2
gsoc2013-epiphany-6b00de66025093218127fa74d9a423d58e377025.tar.lz
gsoc2013-epiphany-6b00de66025093218127fa74d9a423d58e377025.tar.xz
gsoc2013-epiphany-6b00de66025093218127fa74d9a423d58e377025.tar.zst
gsoc2013-epiphany-6b00de66025093218127fa74d9a423d58e377025.zip
Port node db saving and RDF export to xml writer api.
2003-11-08 Christian Persch <chpe@cvs.gnome.org> * embed/ephy-favicon-cache.c: (ephy_favicon_cache_get_type), (ephy_favicon_cache_finalize): * embed/ephy-history.c: (ephy_history_save): * lib/ephy-file-helpers.c: (ephy_file_switch_temp_file): * lib/ephy-file-helpers.h: * lib/ephy-node-db.c: (ephy_node_db_load_from_file), (ephy_node_db_write_to_xml_valist), (ephy_node_db_write_to_xml_safe): * lib/ephy-node-db.h: * lib/ephy-node.c: (write_parent), (ephy_node_write_to_xml): * lib/ephy-node.h: * lib/ephy-state.c: (ephy_states_save), (ensure_states): * src/bookmarks/ephy-bookmarks-export.c: (write_topics_list), (ephy_bookmarks_export_rdf): * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_save): Port node db saving and RDF export to xml writer api.
Diffstat (limited to 'embed/ephy-history.c')
-rw-r--r--embed/ephy-history.c52
1 files changed, 13 insertions, 39 deletions
diff --git a/embed/ephy-history.c b/embed/ephy-history.c
index 871212755..8afbead0e 100644
--- a/embed/ephy-history.c
+++ b/embed/ephy-history.c
@@ -25,6 +25,7 @@
#include "ephy-history.h"
#include "ephy-file-helpers.h"
#include "ephy-debug.h"
+#include "ephy-node-db.h"
#include "ephy-node-common.h"
#include <time.h>
@@ -36,7 +37,7 @@
#define EPHY_HISTORY_XML_VERSION "1.0"
/* how often to save the history, in milliseconds */
-#define HISTORY_SAVE_INTERVAL (60 * 5 * 1000)
+#define HISTORY_SAVE_INTERVAL (5 * 60 * 1000)
/* if you change this remember to change also the user interface description */
#define HISTORY_PAGE_OBSOLETE_DAYS 10
@@ -176,12 +177,7 @@ remove_obsolete_pages (EphyHistory *eb)
static void
ephy_history_save (EphyHistory *eb)
{
- xmlDocPtr doc;
- xmlNodePtr root;
- GPtrArray *children;
- int i;
-
- LOG ("Saving history")
+ int ret;
/* only save if there are changes */
if (eb->priv->dirty == FALSE)
@@ -189,44 +185,22 @@ ephy_history_save (EphyHistory *eb)
return;
}
- /* save nodes to xml */
- xmlIndentTreeOutput = TRUE;
- doc = xmlNewDoc ("1.0");
-
- root = xmlNewDocNode (doc, NULL, "ephy_history", NULL);
- xmlSetProp (root, "version", EPHY_HISTORY_XML_VERSION);
- xmlDocSetRootElement (doc, root);
-
- children = ephy_node_get_children (eb->priv->hosts);
- for (i = 0; i < children->len; i++)
- {
- EphyNode *kid;
-
- kid = g_ptr_array_index (children, i);
- if (kid == eb->priv->pages) continue;
-
- ephy_node_save_to_xml (kid, root);
- }
- ephy_node_thaw (eb->priv->hosts);
-
- children = ephy_node_get_children (eb->priv->pages);
- for (i = 0; i < children->len; i++)
- {
- EphyNode *kid;
+ LOG ("Saving history db")
- kid = g_ptr_array_index (children, i);
+ ret = ephy_node_db_write_to_xml_safe
+ (eb->priv->db, eb->priv->xml_file,
+ EPHY_HISTORY_XML_ROOT,
+ EPHY_HISTORY_XML_VERSION,
+ NULL, /* comment */
+ eb->priv->hosts, 0,
+ eb->priv->pages, 0,
+ NULL);
- ephy_node_save_to_xml (kid, root);
- }
- ephy_node_thaw (eb->priv->pages);
-
- if (ephy_file_save_xml (eb->priv->xml_file, doc))
+ if (ret >=0)
{
/* save was successful */
eb->priv->dirty = FALSE;
}
-
- xmlFreeDoc(doc);
}
static void