diff options
-rw-r--r-- | content/urldb.c | 29 | ||||
-rw-r--r-- | content/urldb.h | 1 | ||||
-rw-r--r-- | desktop/options.c | 5 | ||||
-rw-r--r-- | riscos/gui.c | 4 | ||||
-rw-r--r-- | riscos/hotlist.c | 7 |
5 files changed, 35 insertions, 11 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); diff --git a/desktop/options.c b/desktop/options.c index 2cd88d371..1787e55a5 100644 --- a/desktop/options.c +++ b/desktop/options.c @@ -435,14 +435,15 @@ void options_load_tree_entry(xmlNode *li, struct node *directory) { if (!data) { /* No entry in database, so add one */ urldb_add_url(url); - /* and bump visit data */ - urldb_update_url_visit_data(url); /* now attempt to get url data */ data = urldb_get_url_data(url); } if (!data) return; + /* Make this URL persistent */ + urldb_set_url_persistence(url, true); + if (!data->title) urldb_set_url_title(url, title); diff --git a/riscos/gui.c b/riscos/gui.c index 702388abd..b62bc0f53 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -1535,7 +1535,7 @@ void ro_msg_dataload(wimp_message *message) data = urldb_get_url_data(url); if (!data) { urldb_add_url(url); - urldb_update_url_visit_data(url); + urldb_set_url_persistence(url, true); data = urldb_get_url_data(url); } if (data) { @@ -2173,7 +2173,7 @@ void ro_gui_view_source(struct content *content) return; } snprintf(full_name, 256, "%s/%s", TEMP_FILENAME_PREFIX, temp_name); - full_name[255] = '\0'; + full_name[255] = '\0'; r = __riscosify(full_name, 0, __RISCOSIFY_NO_SUFFIX, message.file_name, 212, 0); if (r == 0) { diff --git a/riscos/hotlist.c b/riscos/hotlist.c index f40484929..e809e53bc 100644 --- a/riscos/hotlist.c +++ b/riscos/hotlist.c @@ -105,8 +105,9 @@ void ro_gui_hotlist_initialise(void) { data = urldb_get_url_data(default_entries[i].url); if (!data) { urldb_add_url(default_entries[i].url); - urldb_update_url_visit_data( - default_entries[i].url); + urldb_set_url_persistence( + default_entries[i].url, + true); data = urldb_get_url_data( default_entries[i].url); } @@ -314,7 +315,7 @@ bool ro_gui_hotlist_dialog_apply(wimp_w w) { data = urldb_get_url_data(url); if (!data) { urldb_add_url(url); - urldb_update_url_visit_data(url); + urldb_set_url_persistence(url, true); data = urldb_get_url_data(url); } if (!data) { |