diff options
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/browser.c | 6 | ||||
-rw-r--r-- | desktop/browser.h | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/desktop/browser.c b/desktop/browser.c index 67c0f93e5..846d915b3 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -265,6 +265,7 @@ void browser_window_open_location_historical(struct browser_window* bw, browser_window_set_status(bw, "Opening page..."); browser_window_start_throbber(bw); bw->time0 = clock(); + bw->history_add = false; bw->loading_content = fetchcache(url, 0, browser_window_callback, bw, 0, gui_window_get_width(bw->window), 0, false, post_urlenc, post_multipart); @@ -294,6 +295,7 @@ void browser_window_open_location_post(struct browser_window* bw, assert(bw != 0 && url0 != 0); url = url_join(url0, bw->url); browser_window_open_location_historical(bw, url, post_urlenc, post_multipart); + bw->history_add = true; /* TODO: move this to somewhere below CONTENT_MSG_READY below */ if (bw->history == NULL) bw->history = history_create(NULL, url); @@ -359,6 +361,10 @@ void browser_window_callback(content_msg msg, struct content *c, bw->current_content = c; bw->loading_content = 0; bw->caret_callback = 0; + if (bw->history_add) + bw->history_entry = history_add(bw->history_entry, bw->url, + bw->current_content->title); + bw->history_add = false; } gui_window_set_redraw_safety(bw->window, previous_safety); if (bw->current_content->status == CONTENT_STATUS_DONE) { diff --git a/desktop/browser.h b/desktop/browser.h index 2afbd83bb..e25472631 100644 --- a/desktop/browser.h +++ b/desktop/browser.h @@ -9,6 +9,7 @@ #ifndef _NETSURF_DESKTOP_BROWSER_H_ #define _NETSURF_DESKTOP_BROWSER_H_ +#include <stdbool.h> #include <time.h> #include "netsurf/content/content.h" #include "netsurf/desktop/gui.h" @@ -40,6 +41,7 @@ struct history struct history* history_create(char* desc, char* url); void history_remember(struct history* current, char* desc, char* url); +struct history_entry; struct browser_window { @@ -51,6 +53,8 @@ struct browser_window void *current_content_state; struct content* loading_content; struct history* history; + struct history_entry *history_entry; + bool history_add; clock_t time0; char* url; @@ -123,4 +127,7 @@ void browser_window_reformat(struct browser_window* bw, int scroll_to_top); void browser_window_key_press(struct browser_window *bw, char key); +struct history_entry * history_add(struct history_entry *current, + char *url, char *title); + #endif |