Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/618ef549838363f337a21...
...commit
http://git.netsurf-browser.org/netsurf.git/commit/618ef549838363f337a2162...
...tree
http://git.netsurf-browser.org/netsurf.git/tree/618ef549838363f337a2162f3...
The branch, master has been updated
via 618ef549838363f337a2162f34c0fa60c6e1899f (commit)
via 07c2add5cc28efa18f7bcaae239879a3bc12a700 (commit)
via 28a04f6da778afe03bc2639c0ecce947b5f36b7f (commit)
via ec9608c4ded5f286d91fcb3df09906b8ac8ec025 (commit)
via 9f72b5e04639e904e71f55cc2385a6ff30ebdc3b (commit)
via 094ef9a64b1d4c89f116fc09780781985738e5e3 (commit)
from 716776a181de46648aa6f65a2931bd5789330682 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=618ef549838363f337a...
commit 618ef549838363f337a2162f34c0fa60c6e1899f
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Update new global history, if the treeview test option is set.
diff --git a/desktop/browser.c b/desktop/browser.c
index 2ab93c9..9f3636e 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -45,6 +45,7 @@
#include "desktop/browser_private.h"
#include "desktop/download.h"
#include "desktop/frames.h"
+#include "desktop/global_history.h"
#include "desktop/gui.h"
#include "desktop/history_global_core.h"
#include "desktop/hotlist.h"
@@ -1247,8 +1248,12 @@ static nserror browser_window_callback(hlcache_handle *c,
urldb_update_url_visit_data(url);
urldb_set_url_content_type(url,
content_get_type(c));
+
/* This is safe as we've just added the URL */
- history_global_add(urldb_get_url(url));
+ if (nsoption_bool(temp_treeview_test) == false)
+ history_global_add(urldb_get_url(url));
+ else
+ global_history_add(urldb_get_url(url));
}
}
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=07c2add5cc28efa18f7...
commit 07c2add5cc28efa18f7bcaae239879a3bc12a700
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Add function to add to global history. Fix add_entry to actually add new entry after
removing an existing one. Implement directory deletion.
diff --git a/desktop/global_history.c b/desktop/global_history.c
index 573bf84..05822d7 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)
{
diff --git a/desktop/global_history.h b/desktop/global_history.h
index 591b1fe..3863e81 100644
--- a/desktop/global_history.h
+++ b/desktop/global_history.h
@@ -22,6 +22,7 @@
#include <stdbool.h>
#include "desktop/core_window.h"
+#include "utils/nsurl.h"
/**
@@ -51,6 +52,16 @@ nserror global_history_init(struct core_window_callback_table *cw_t,
nserror global_history_fini(void);
/**
+ * Add an entry to the global history.
+ *
+ * If the URL already exists in the global history, the old node is removed.
+ *
+ * \param url URL for node being added
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+nserror global_history_add(nsurl *url);
+
+/**
* Redraw the global history.
*
* \param x X coordinate to render treeview at
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=28a04f6da778afe03bc...
commit 28a04f6da778afe03bc2639c0ecce947b5f36b7f
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Reset entry url's urldb visit data when user deletes entry from global history.
diff --git a/desktop/global_history.c b/desktop/global_history.c
index a60cccd..573bf84 100644
--- a/desktop/global_history.c
+++ b/desktop/global_history.c
@@ -61,6 +61,8 @@ struct global_history_ctx {
struct global_history_ctx gh_ctx;
struct global_history_entry {
+ bool user_delete;
+
int slot;
nsurl *url;
time_t t;
@@ -349,6 +351,7 @@ static nserror global_history_add_entry_internal(nsurl *url, int
slot,
return false;
}
+ e->user_delete = false;
e->slot = slot;
e->url = nsurl_ref(url);
e->t = data->last_visit;
@@ -433,11 +436,18 @@ static void global_history_delete_entry_internal(
e->next->prev = e->prev;
}
- /* Destroy */
+ if (e->user_delete) {
+ /* User requested delete, so delete from urldb too. */
+ urldb_reset_url_visit_data(e->url);
+ }
+
+ /* Destroy fields */
free((void *)e->data[0].value); /* Eww */
free((void *)e->data[2].value); /* Eww */
free((void *)e->data[3].value); /* Eww */
nsurl_unref(e->url);
+
+ /* Destroy entry */
free(e);
}
@@ -477,7 +487,7 @@ static bool global_history_add_entry(nsurl *url,
/* See if there's already an entry for this URL */
e = global_history_find(url);
if (e != NULL) {
- /* Existing entry. Delete it. */
+ /* Existing entry. */
treeview_delete_node(gh_ctx.tree, e->entry);
return true;
}
@@ -643,6 +653,7 @@ static nserror global_history_tree_node_entry_cb(
switch (msg.msg) {
case TREE_MSG_NODE_DELETE:
e->entry = NULL;
+ e->user_delete = msg.data.delete.user;
global_history_delete_entry_internal(e);
break;
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=ec9608c4ded5f286d91...
commit ec9608c4ded5f286d91fcb3df09906b8ac8ec025
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Make node delete callback msg differentiate between deletes caused by user interaction
and other deletes (e.g. treeview destruction).
diff --git a/desktop/treeview.c b/desktop/treeview.c
index c15c9ee..b920073 100644
--- a/desktop/treeview.c
+++ b/desktop/treeview.c
@@ -576,6 +576,7 @@ static nserror treeview_walk_internal(treeview_node *root, bool full,
struct treeview_node_delete {
treeview *tree;
int height_reduction;
+ bool user_interaction;
};
/** Treewalk node callback deleting nodes. */
static nserror treeview_delete_node_walk_cb(treeview_node *n,
@@ -584,6 +585,7 @@ static nserror treeview_delete_node_walk_cb(treeview_node *n,
struct treeview_node_delete *nd = (struct treeview_node_delete *)ctx;
struct treeview_node_msg msg;
msg.msg = TREE_MSG_NODE_DELETE;
+ msg.data.delete.user = nd->user_interaction;
assert(n->children == NULL);
@@ -651,7 +653,8 @@ static nserror treeview_delete_node_internal(treeview *tree,
treeview_node *n,
treeview_node *p = n->parent;
struct treeview_node_delete nd = {
.tree = tree,
- .height_reduction = 0
+ .height_reduction = 0,
+ .user_interaction = interaction
};
if (interaction && (tree->flags & TREEVIEW_NO_DELETES)) {
@@ -691,13 +694,14 @@ static nserror treeview_delete_node_internal(treeview *tree,
treeview_node *n,
* Delete a treeview node
*
* \param tree Treeview object to delete empty nodes from
+ * \param interaction Delete is result of user interaction with treeview
* \return NSERROR_OK on success, appropriate error otherwise
*
* Note this must not be called within a treeview_walk. It may delete the
* walker's 'current' node, making it impossible to move on without invalid
* reads.
*/
-static nserror treeview_delete_empty_nodes(treeview *tree)
+static nserror treeview_delete_empty_nodes(treeview *tree, bool interaction)
{
treeview_node *node, *child, *parent, *next_sibling;
treeview_node *root = tree->root;
@@ -705,7 +709,8 @@ static nserror treeview_delete_empty_nodes(treeview *tree)
nserror err;
struct treeview_node_delete nd = {
.tree = tree,
- .height_reduction = 0
+ .height_reduction = 0,
+ .user_interaction = interaction
};
node = root;
@@ -778,7 +783,7 @@ nserror treeview_delete_node(treeview *tree, treeview_node *n)
if (tree->flags & TREEVIEW_DEL_EMPTY_DIRS) {
/* Delete any empty nodes */
- err = treeview_delete_empty_nodes(tree);
+ err = treeview_delete_empty_nodes(tree, false);
if (err != NSERROR_OK)
return err;
}
@@ -1686,7 +1691,7 @@ bool treeview_keypress(treeview *tree, uint32_t key)
if (tree->flags & TREEVIEW_DEL_EMPTY_DIRS) {
/* Delete any empty nodes */
- err = treeview_delete_empty_nodes(tree);
+ err = treeview_delete_empty_nodes(tree, true);
r.y0 = 0;
}
break;
diff --git a/desktop/treeview.h b/desktop/treeview.h
index 5662dfa..82a7af1 100644
--- a/desktop/treeview.h
+++ b/desktop/treeview.h
@@ -60,6 +60,9 @@ struct treeview_node_msg {
enum treeview_msg msg; /**< The message type */
union {
struct {
+ bool user; /* True iff delete by user interaction */
+ } delete;
+ struct {
lwc_string *feild; /* The field being edited */
const char *text; /* The proposed new value */
} node_edit; /* Client may call treeview_update_node_* */
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=9f72b5e04639e904e71...
commit 9f72b5e04639e904e71f55cc2385a6ff30ebdc3b
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Fix namespace of old global history add function.
diff --git a/desktop/browser.c b/desktop/browser.c
index 1cc3693..2ab93c9 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -1248,7 +1248,7 @@ static nserror browser_window_callback(hlcache_handle *c,
urldb_set_url_content_type(url,
content_get_type(c));
/* This is safe as we've just added the URL */
- global_history_add(urldb_get_url(url));
+ history_global_add(urldb_get_url(url));
}
}
diff --git a/desktop/history_global_core.c b/desktop/history_global_core.c
index 2a941e0..ce43830 100644
--- a/desktop/history_global_core.c
+++ b/desktop/history_global_core.c
@@ -90,7 +90,7 @@ static struct node *history_global_find(const char *url)
* \param data URL data associated with URL
* \return true (for urldb_iterate_entries)
*/
-static bool global_history_add_internal(nsurl *url, const struct url_data *data)
+static bool history_global_add_internal(nsurl *url, const struct url_data *data)
{
int i, j;
struct node *parent = NULL;
@@ -281,7 +281,7 @@ bool history_global_initialise(struct tree *tree, const char*
folder_icon_name)
LOG(("Building history tree"));
global_history_initialised = true;
- urldb_iterate_entries(global_history_add_internal);
+ urldb_iterate_entries(history_global_add_internal);
global_history_initialised = false;
tree_set_node_expanded(global_history_tree, global_history_tree_root,
false, true, true);
@@ -316,7 +316,7 @@ void history_global_cleanup(void)
*
* \param url the url to be added
*/
-void global_history_add(nsurl *url)
+void history_global_add(nsurl *url)
{
const struct url_data *data;
@@ -324,7 +324,7 @@ void global_history_add(nsurl *url)
if (data == NULL)
return;
- global_history_add_internal(url, data);
+ history_global_add_internal(url, data);
}
diff --git a/desktop/history_global_core.h b/desktop/history_global_core.h
index c55a23c..9bf5a0b 100644
--- a/desktop/history_global_core.h
+++ b/desktop/history_global_core.h
@@ -28,7 +28,7 @@ bool history_global_initialise(struct tree *tree, const char*
folder_icon_name);
unsigned int history_global_get_tree_flags(void);
void history_global_cleanup(void);
-void global_history_add(nsurl *url);
+void history_global_add(nsurl *url);
bool history_global_export(const char *path);
void history_global_delete_selected(void);
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=094ef9a64b1d4c89f11...
commit 094ef9a64b1d4c89f116fc09780781985738e5e3
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Minor wrapping fix.
diff --git a/desktop/browser.c b/desktop/browser.c
index 7ca91d3..1cc3693 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -1767,7 +1767,8 @@ nserror browser_window_navigate(struct browser_window *bw,
if ((bw->current_content != NULL) &&
(hlcache_handle_get_url(bw->current_content) != NULL)) {
same_url = nsurl_compare(url,
- hlcache_handle_get_url(bw->current_content),
+ hlcache_handle_get_url(
+ bw->current_content),
NSURL_COMPLETE);
}
@@ -1792,7 +1793,8 @@ nserror browser_window_navigate(struct browser_window *bw,
if (bw->current_content != NULL) {
browser_window_refresh_url_bar(bw,
- hlcache_handle_get_url(bw->current_content),
+ hlcache_handle_get_url(
+ bw->current_content),
bw->frag_id);
}
return NSERROR_OK;
-----------------------------------------------------------------------
Summary of changes:
desktop/browser.c | 13 ++++++++--
desktop/global_history.c | 52 ++++++++++++++++++++++++++++++++++++----
desktop/global_history.h | 11 ++++++++
desktop/history_global_core.c | 8 +++---
desktop/history_global_core.h | 2 +-
desktop/treeview.c | 15 ++++++++----
desktop/treeview.h | 3 ++
7 files changed, 85 insertions(+), 19 deletions(-)
diff --git a/desktop/browser.c b/desktop/browser.c
index 7ca91d3..9f3636e 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -45,6 +45,7 @@
#include "desktop/browser_private.h"
#include "desktop/download.h"
#include "desktop/frames.h"
+#include "desktop/global_history.h"
#include "desktop/gui.h"
#include "desktop/history_global_core.h"
#include "desktop/hotlist.h"
@@ -1247,8 +1248,12 @@ static nserror browser_window_callback(hlcache_handle *c,
urldb_update_url_visit_data(url);
urldb_set_url_content_type(url,
content_get_type(c));
+
/* This is safe as we've just added the URL */
- global_history_add(urldb_get_url(url));
+ if (nsoption_bool(temp_treeview_test) == false)
+ history_global_add(urldb_get_url(url));
+ else
+ global_history_add(urldb_get_url(url));
}
}
@@ -1767,7 +1772,8 @@ nserror browser_window_navigate(struct browser_window *bw,
if ((bw->current_content != NULL) &&
(hlcache_handle_get_url(bw->current_content) != NULL)) {
same_url = nsurl_compare(url,
- hlcache_handle_get_url(bw->current_content),
+ hlcache_handle_get_url(
+ bw->current_content),
NSURL_COMPLETE);
}
@@ -1792,7 +1798,8 @@ nserror browser_window_navigate(struct browser_window *bw,
if (bw->current_content != NULL) {
browser_window_refresh_url_bar(bw,
- hlcache_handle_get_url(bw->current_content),
+ hlcache_handle_get_url(
+ bw->current_content),
bw->frag_id);
}
return NSERROR_OK;
diff --git a/desktop/global_history.c b/desktop/global_history.c
index a60cccd..05822d7 100644
--- a/desktop/global_history.c
+++ b/desktop/global_history.c
@@ -61,6 +61,8 @@ struct global_history_ctx {
struct global_history_ctx gh_ctx;
struct global_history_entry {
+ bool user_delete;
+
int slot;
nsurl *url;
time_t t;
@@ -349,6 +351,7 @@ static nserror global_history_add_entry_internal(nsurl *url, int
slot,
return false;
}
+ e->user_delete = false;
e->slot = slot;
e->url = nsurl_ref(url);
e->t = data->last_visit;
@@ -433,11 +436,18 @@ static void global_history_delete_entry_internal(
e->next->prev = e->prev;
}
- /* Destroy */
+ if (e->user_delete) {
+ /* User requested delete, so delete from urldb too. */
+ urldb_reset_url_visit_data(e->url);
+ }
+
+ /* Destroy fields */
free((void *)e->data[0].value); /* Eww */
free((void *)e->data[2].value); /* Eww */
free((void *)e->data[3].value); /* Eww */
nsurl_unref(e->url);
+
+ /* Destroy entry */
free(e);
}
@@ -452,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;
@@ -473,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. Delete it. */
treeview_delete_node(gh_ctx.tree, e->entry);
- return true;
}
}
@@ -633,16 +641,31 @@ 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:
e->entry = NULL;
+ e->user_delete = msg.data.delete.user;
global_history_delete_entry_internal(e);
break;
@@ -771,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)
{
diff --git a/desktop/global_history.h b/desktop/global_history.h
index 591b1fe..3863e81 100644
--- a/desktop/global_history.h
+++ b/desktop/global_history.h
@@ -22,6 +22,7 @@
#include <stdbool.h>
#include "desktop/core_window.h"
+#include "utils/nsurl.h"
/**
@@ -51,6 +52,16 @@ nserror global_history_init(struct core_window_callback_table *cw_t,
nserror global_history_fini(void);
/**
+ * Add an entry to the global history.
+ *
+ * If the URL already exists in the global history, the old node is removed.
+ *
+ * \param url URL for node being added
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+nserror global_history_add(nsurl *url);
+
+/**
* Redraw the global history.
*
* \param x X coordinate to render treeview at
diff --git a/desktop/history_global_core.c b/desktop/history_global_core.c
index 2a941e0..ce43830 100644
--- a/desktop/history_global_core.c
+++ b/desktop/history_global_core.c
@@ -90,7 +90,7 @@ static struct node *history_global_find(const char *url)
* \param data URL data associated with URL
* \return true (for urldb_iterate_entries)
*/
-static bool global_history_add_internal(nsurl *url, const struct url_data *data)
+static bool history_global_add_internal(nsurl *url, const struct url_data *data)
{
int i, j;
struct node *parent = NULL;
@@ -281,7 +281,7 @@ bool history_global_initialise(struct tree *tree, const char*
folder_icon_name)
LOG(("Building history tree"));
global_history_initialised = true;
- urldb_iterate_entries(global_history_add_internal);
+ urldb_iterate_entries(history_global_add_internal);
global_history_initialised = false;
tree_set_node_expanded(global_history_tree, global_history_tree_root,
false, true, true);
@@ -316,7 +316,7 @@ void history_global_cleanup(void)
*
* \param url the url to be added
*/
-void global_history_add(nsurl *url)
+void history_global_add(nsurl *url)
{
const struct url_data *data;
@@ -324,7 +324,7 @@ void global_history_add(nsurl *url)
if (data == NULL)
return;
- global_history_add_internal(url, data);
+ history_global_add_internal(url, data);
}
diff --git a/desktop/history_global_core.h b/desktop/history_global_core.h
index c55a23c..9bf5a0b 100644
--- a/desktop/history_global_core.h
+++ b/desktop/history_global_core.h
@@ -28,7 +28,7 @@ bool history_global_initialise(struct tree *tree, const char*
folder_icon_name);
unsigned int history_global_get_tree_flags(void);
void history_global_cleanup(void);
-void global_history_add(nsurl *url);
+void history_global_add(nsurl *url);
bool history_global_export(const char *path);
void history_global_delete_selected(void);
diff --git a/desktop/treeview.c b/desktop/treeview.c
index c15c9ee..b920073 100644
--- a/desktop/treeview.c
+++ b/desktop/treeview.c
@@ -576,6 +576,7 @@ static nserror treeview_walk_internal(treeview_node *root, bool full,
struct treeview_node_delete {
treeview *tree;
int height_reduction;
+ bool user_interaction;
};
/** Treewalk node callback deleting nodes. */
static nserror treeview_delete_node_walk_cb(treeview_node *n,
@@ -584,6 +585,7 @@ static nserror treeview_delete_node_walk_cb(treeview_node *n,
struct treeview_node_delete *nd = (struct treeview_node_delete *)ctx;
struct treeview_node_msg msg;
msg.msg = TREE_MSG_NODE_DELETE;
+ msg.data.delete.user = nd->user_interaction;
assert(n->children == NULL);
@@ -651,7 +653,8 @@ static nserror treeview_delete_node_internal(treeview *tree,
treeview_node *n,
treeview_node *p = n->parent;
struct treeview_node_delete nd = {
.tree = tree,
- .height_reduction = 0
+ .height_reduction = 0,
+ .user_interaction = interaction
};
if (interaction && (tree->flags & TREEVIEW_NO_DELETES)) {
@@ -691,13 +694,14 @@ static nserror treeview_delete_node_internal(treeview *tree,
treeview_node *n,
* Delete a treeview node
*
* \param tree Treeview object to delete empty nodes from
+ * \param interaction Delete is result of user interaction with treeview
* \return NSERROR_OK on success, appropriate error otherwise
*
* Note this must not be called within a treeview_walk. It may delete the
* walker's 'current' node, making it impossible to move on without invalid
* reads.
*/
-static nserror treeview_delete_empty_nodes(treeview *tree)
+static nserror treeview_delete_empty_nodes(treeview *tree, bool interaction)
{
treeview_node *node, *child, *parent, *next_sibling;
treeview_node *root = tree->root;
@@ -705,7 +709,8 @@ static nserror treeview_delete_empty_nodes(treeview *tree)
nserror err;
struct treeview_node_delete nd = {
.tree = tree,
- .height_reduction = 0
+ .height_reduction = 0,
+ .user_interaction = interaction
};
node = root;
@@ -778,7 +783,7 @@ nserror treeview_delete_node(treeview *tree, treeview_node *n)
if (tree->flags & TREEVIEW_DEL_EMPTY_DIRS) {
/* Delete any empty nodes */
- err = treeview_delete_empty_nodes(tree);
+ err = treeview_delete_empty_nodes(tree, false);
if (err != NSERROR_OK)
return err;
}
@@ -1686,7 +1691,7 @@ bool treeview_keypress(treeview *tree, uint32_t key)
if (tree->flags & TREEVIEW_DEL_EMPTY_DIRS) {
/* Delete any empty nodes */
- err = treeview_delete_empty_nodes(tree);
+ err = treeview_delete_empty_nodes(tree, true);
r.y0 = 0;
}
break;
diff --git a/desktop/treeview.h b/desktop/treeview.h
index 5662dfa..82a7af1 100644
--- a/desktop/treeview.h
+++ b/desktop/treeview.h
@@ -60,6 +60,9 @@ struct treeview_node_msg {
enum treeview_msg msg; /**< The message type */
union {
struct {
+ bool user; /* True iff delete by user interaction */
+ } delete;
+ struct {
lwc_string *feild; /* The field being edited */
const char *text; /* The proposed new value */
} node_edit; /* Client may call treeview_update_node_* */
--
NetSurf Browser