diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2013-07-16 13:13:33 +0100 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2013-07-16 13:13:33 +0100 |
commit | 07c2add5cc28efa18f7bcaae239879a3bc12a700 (patch) | |
tree | 9d84bed9a2d322db30de3a443ea21ea43dad9b45 /desktop/global_history.c | |
parent | 28a04f6da778afe03bc2639c0ecce947b5f36b7f (diff) | |
download | netsurf-07c2add5cc28efa18f7bcaae239879a3bc12a700.tar.gz netsurf-07c2add5cc28efa18f7bcaae239879a3bc12a700.tar.bz2 |
Add function to add to global history. Fix add_entry to actually add new entry after removing an existing one. Implement directory deletion.
Diffstat (limited to 'desktop/global_history.c')
-rw-r--r-- | desktop/global_history.c | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/desktop/global_history.c b/desktop/global_history.c index 573bf84b8..05822d741 100644 --- a/desktop/global_history.c +++ b/desktop/global_history.c @@ -462,7 +462,6 @@ static bool global_history_add_entry(nsurl *url, const struct url_data *data) { int slot; - struct global_history_entry *e; time_t visit_date; time_t earliest_date = gh_ctx.today - (N_DAYS - 1) * N_SEC_PER_DAY; bool got_treeview = gh_ctx.tree != NULL; @@ -483,13 +482,12 @@ static bool global_history_add_entry(nsurl *url, if (got_treeview == true) { /* The treeview for global history already exists */ + struct global_history_entry *e; - /* See if there's already an entry for this URL */ + /* Delete any existing entry for this URL */ e = global_history_find(url); if (e != NULL) { - /* Existing entry. */ treeview_delete_node(gh_ctx.tree, e->entry); - return true; } } @@ -643,12 +641,26 @@ static nserror global_history_init_entries(void) static nserror global_history_tree_node_folder_cb( struct treeview_node_msg msg, void *data) { + struct global_history_folder *f = data; + + switch (msg.msg) { + case TREE_MSG_NODE_DELETE: + f->folder = NULL; + break; + + case TREE_MSG_NODE_EDIT: + break; + + case TREE_MSG_NODE_LAUNCH: + break; + } + return NSERROR_OK; } static nserror global_history_tree_node_entry_cb( struct treeview_node_msg msg, void *data) { - struct global_history_entry *e = (struct global_history_entry *)data; + struct global_history_entry *e = data; switch (msg.msg) { case TREE_MSG_NODE_DELETE: @@ -782,6 +794,23 @@ nserror global_history_fini(void) /* Exported interface, documented in global_history.h */ +nserror global_history_add(nsurl *url) +{ + const struct url_data *data; + + data = urldb_get_url_data(url); + if (data == NULL) { + LOG(("Can't add URL to history that's not present in urldb.")); + return NSERROR_BAD_PARAMETER; + } + + global_history_add_entry(url, data); + + return NSERROR_OK; +} + + +/* Exported interface, documented in global_history.h */ void global_history_redraw(int x, int y, struct rect *clip, const struct redraw_context *ctx) { |