summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2006-06-14 22:46:12 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2006-06-14 22:46:12 +0000
commitc1dbdad995bc41ad26fd50721c3f6e872171de20 (patch)
treef90a4a359ecfa9be1d7e8276ddc3541ae2d020a4 /content
parent217e59aebefb1a0a17fd713a8e38c2563cda8c8c (diff)
downloadnetsurf-c1dbdad995bc41ad26fd50721c3f6e872171de20.tar.gz
netsurf-c1dbdad995bc41ad26fd50721c3f6e872171de20.tar.bz2
Provide persistent flag for urldb entries.
Make hotlist use this, rather than abusing the last visited date. This fixes the hotlist being copied to global history issue. svn path=/trunk/netsurf/; revision=2619
Diffstat (limited to 'content')
-rw-r--r--content/urldb.c29
-rw-r--r--content/urldb.h1
2 files changed, 26 insertions, 4 deletions
diff --git a/content/urldb.c b/content/urldb.c
index f150aeb25..43aff459f 100644
--- a/content/urldb.c
+++ b/content/urldb.c
@@ -125,6 +125,7 @@ struct path_data {
char *segment; /**< Path segment for this node */
unsigned int frag_cnt; /**< Number of entries in ::fragment */
char **fragment; /**< Array of fragments */
+ bool persistent; /**< This entry should persist */
struct bitmap *thumb; /**< Thumbnail image of resource */
struct url_internal_data urld; /**< URL data for resource */
@@ -548,8 +549,8 @@ void urldb_count_urls(const struct path_data *root, time_t expiry,
const struct path_data *p;
if (!root->children) {
- if ((root->urld.last_visit > expiry) &&
- (root->urld.visits > 0))
+ if (root->persistent || ((root->urld.last_visit > expiry) &&
+ (root->urld.visits > 0)))
(*count)++;
}
@@ -578,8 +579,9 @@ void urldb_write_paths(const struct path_data *parent, const char *host,
if (!parent->children) {
/* leaf node */
- if (!((parent->urld.last_visit > expiry) &&
- (parent->urld.visits > 0)))
+ if (!(parent->persistent ||
+ ((parent->urld.last_visit > expiry) &&
+ (parent->urld.visits > 0))))
/* expired */
return;
@@ -649,6 +651,25 @@ void urldb_write_paths(const struct path_data *parent, const char *host,
}
/**
+ * Set the cross-session persistence of the entry for an URL
+ *
+ * \param url Absolute URL to persist
+ * \param persist True to persist, false otherwise
+ */
+void urldb_set_url_persistence(const char *url, bool persist)
+{
+ struct path_data *p;
+
+ assert(url);
+
+ p = urldb_find_url(url);
+ if (!p)
+ return;
+
+ p->persistent = persist;
+}
+
+/**
* Insert an URL into the database
*
* \param url Absolute URL to insert
diff --git a/content/urldb.h b/content/urldb.h
index b7f57ebdd..e919549bf 100644
--- a/content/urldb.h
+++ b/content/urldb.h
@@ -28,6 +28,7 @@ struct bitmap;
/* Persistence support */
void urldb_load(const char *filename);
void urldb_save(const char *filename);
+void urldb_set_url_persistence(const char *url, bool persist);
/* URL insertion */
bool urldb_add_url(const char *url);