summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Wilson <rjw@netsurf-browser.org>2005-12-31 04:30:49 +0000
committerRichard Wilson <rjw@netsurf-browser.org>2005-12-31 04:30:49 +0000
commite6f311f97c3a5c43217e0f2ff894e0159d9facad (patch)
treef08804bb86d4818c2f6ab0511bb6ddcc1046ddf7
parentfaabbafa38152dd7a90c96b33dd67da5a6ec487b (diff)
downloadnetsurf-e6f311f97c3a5c43217e0f2ff894e0159d9facad.tar.gz
netsurf-e6f311f97c3a5c43217e0f2ff894e0159d9facad.tar.bz2
[project @ 2005-12-31 04:30:49 by rjw]
Updates to work with new url_store system. svn path=/import/netsurf/; revision=1909
-rw-r--r--content/fetchcache.c5
-rw-r--r--desktop/browser.c20
-rw-r--r--desktop/browser.h3
3 files changed, 16 insertions, 12 deletions
diff --git a/content/fetchcache.c b/content/fetchcache.c
index 93c35b2a2..c58d9d34f 100644
--- a/content/fetchcache.c
+++ b/content/fetchcache.c
@@ -211,7 +211,6 @@ void fetchcache_go(struct content *content, char *referer,
void fetchcache_callback(fetch_msg msg, void *p, const char *data,
unsigned long size)
{
- struct url_content *url_content;
bool res;
struct content *c = p;
content_type type;
@@ -278,10 +277,6 @@ void fetchcache_callback(fetch_msg msg, void *p, const char *data,
break;
case FETCH_FINISHED:
- url_content = url_store_find(c->url);
- if (url_content)
- url_content->requests++;
-
c->fetch = 0;
content_set_status(c, messages_get("Converting"),
c->source_size);
diff --git a/desktop/browser.c b/desktop/browser.c
index 58da058d4..41b1baed5 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -164,7 +164,6 @@ void browser_window_go_post(struct browser_window *bw, const char *url,
char *url2;
char *hash;
url_func_result res;
- struct url_content *url_content;
char url_buf[256];
LOG(("bw %p, url %s", bw, url));
@@ -211,10 +210,6 @@ void browser_window_go_post(struct browser_window *bw, const char *url,
browser_window_stop(bw);
browser_window_remove_caret(bw);
- url_content = url_store_find(url2);
- if (url_content)
- url_content->visits++;
-
browser_window_set_status(bw, messages_get("Loading"));
bw->history_add = history_add;
bw->time0 = clock();
@@ -255,9 +250,11 @@ void browser_window_go_post(struct browser_window *bw, const char *url,
void browser_window_callback(content_msg msg, struct content *c,
intptr_t p1, intptr_t p2, union content_msg_data data)
{
+ struct url_content *url_content;
struct browser_window *bw = (struct browser_window *) p1;
char status[40];
char url[256];
+ char *title;
switch (msg) {
case CONTENT_MSG_LOADING:
@@ -317,7 +314,18 @@ void browser_window_callback(content_msg msg, struct content *c,
browser_window_set_status(bw, c->status_message);
if (bw->history_add) {
history_add(bw->history, c, bw->frag_id);
- global_history_add(bw->window);
+ url_content = url_store_find(c->url);
+ if (url_content) {
+ title = strdup(c->title);
+ if (title) {
+ free(url_content->title);
+ url_content->title = title;
+ }
+ url_content->visits++;
+ url_content->last_visit = time(NULL);
+ url_content->type = c->type;
+ global_history_add(url_content);
+ }
}
if (c->type == CONTENT_HTML)
selection_init(bw->sel, bw->current_content->data.html.layout);
diff --git a/desktop/browser.h b/desktop/browser.h
index 1ff74a97d..67da0abea 100644
--- a/desktop/browser.h
+++ b/desktop/browser.h
@@ -16,6 +16,7 @@
#include <stdbool.h>
#include <stddef.h>
#include <time.h>
+#include "netsurf/content/url_store.h"
struct box;
struct content;
@@ -161,7 +162,7 @@ bool history_back_available(struct history *history);
bool history_forward_available(struct history *history);
/* In platform specific global_history.c. */
-void global_history_add(struct gui_window *g);
+void global_history_add(struct url_content *data);
void global_history_add_recent(const char *url);
char **global_history_get_recent(int *count);