Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/4f238758db628ee62e4c6...
...commit
http://git.netsurf-browser.org/netsurf.git/commit/4f238758db628ee62e4c644...
...tree
http://git.netsurf-browser.org/netsurf.git/tree/4f238758db628ee62e4c64411...
The branch, master has been updated
via 4f238758db628ee62e4c64411b9f7860dc9f46d1 (commit)
via 657d6ed587a4d27510de7c5836d790e1589c1075 (commit)
from 520503bc7e8233034edb748c9075b1243789cd27 (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=4f238758db628ee62e4...
commit 4f238758db628ee62e4c64411b9f7860dc9f46d1
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Don't allow empty folders.
diff --git a/desktop/global_history.c b/desktop/global_history.c
index e5326c6..d3d3391 100644
--- a/desktop/global_history.c
+++ b/desktop/global_history.c
@@ -712,7 +712,7 @@ nserror global_history_init(struct core_window_callback_table *cw_t,
err = treeview_create(&gh_ctx.tree, &tree_cb_t,
N_FIELDS, gh_ctx.fields,
cw_t, core_window_handle,
- TREEVIEW_NO_MOVES);
+ TREEVIEW_NO_MOVES | TREEVIEW_DEL_EMPTY_DIRS);
if (err != NSERROR_OK) {
gh_ctx.tree = NULL;
return err;
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=657d6ed587a4d27510d...
commit 657d6ed587a4d27510de7c5836d790e1589c1075
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Implement DEL_EMPTY_DIRS flag.
diff --git a/desktop/treeview.c b/desktop/treeview.c
index 7603033..45d3a08 100644
--- a/desktop/treeview.c
+++ b/desktop/treeview.c
@@ -485,15 +485,18 @@ static nserror treeview_delete_node_internal(struct treeview *tree,
struct treeview_node_msg msg;
msg.msg = TREE_MSG_NODE_DELETE;
struct treeview_node *p;
+ static int nest_depth = 0;
if (interaction && (tree->flags & TREEVIEW_NO_DELETES)) {
return NSERROR_OK;
}
/* Destroy children first */
+ nest_depth++;
while (n->children != NULL) {
treeview_delete_node_internal(tree, n->children, interaction);
}
+ nest_depth--;
/* Unlink node from tree */
if (n->parent != NULL && n->parent->children == n) {
@@ -531,8 +534,23 @@ static nserror treeview_delete_node_internal(struct treeview *tree,
return NSERROR_BAD_PARAMETER;
}
- /* Inform front end of change in dimensions */
- tree->cw_t->update_size(tree->cw_h, -1, tree->root->height);
+ if (nest_depth == 0) {
+ /* This is the node we were originally asked to delete */
+
+ if (tree->flags & TREEVIEW_DEL_EMPTY_DIRS &&
+ n->parent != NULL &&
+ n->parent->type != TREE_NODE_ROOT &&
+ n->parent->children == NULL) {
+ /* Delete empty parent */
+ nest_depth++;
+ treeview_delete_node_internal(tree, n->parent,
+ interaction);
+ nest_depth--;
+ }
+
+ /* Inform front end of change in dimensions */
+ tree->cw_t->update_size(tree->cw_h, -1, tree->root->height);
+ }
/* Free the node */
free(n);
-----------------------------------------------------------------------
Summary of changes:
desktop/global_history.c | 2 +-
desktop/treeview.c | 22 ++++++++++++++++++++--
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/desktop/global_history.c b/desktop/global_history.c
index e5326c6..d3d3391 100644
--- a/desktop/global_history.c
+++ b/desktop/global_history.c
@@ -712,7 +712,7 @@ nserror global_history_init(struct core_window_callback_table *cw_t,
err = treeview_create(&gh_ctx.tree, &tree_cb_t,
N_FIELDS, gh_ctx.fields,
cw_t, core_window_handle,
- TREEVIEW_NO_MOVES);
+ TREEVIEW_NO_MOVES | TREEVIEW_DEL_EMPTY_DIRS);
if (err != NSERROR_OK) {
gh_ctx.tree = NULL;
return err;
diff --git a/desktop/treeview.c b/desktop/treeview.c
index 7603033..45d3a08 100644
--- a/desktop/treeview.c
+++ b/desktop/treeview.c
@@ -485,15 +485,18 @@ static nserror treeview_delete_node_internal(struct treeview *tree,
struct treeview_node_msg msg;
msg.msg = TREE_MSG_NODE_DELETE;
struct treeview_node *p;
+ static int nest_depth = 0;
if (interaction && (tree->flags & TREEVIEW_NO_DELETES)) {
return NSERROR_OK;
}
/* Destroy children first */
+ nest_depth++;
while (n->children != NULL) {
treeview_delete_node_internal(tree, n->children, interaction);
}
+ nest_depth--;
/* Unlink node from tree */
if (n->parent != NULL && n->parent->children == n) {
@@ -531,8 +534,23 @@ static nserror treeview_delete_node_internal(struct treeview *tree,
return NSERROR_BAD_PARAMETER;
}
- /* Inform front end of change in dimensions */
- tree->cw_t->update_size(tree->cw_h, -1, tree->root->height);
+ if (nest_depth == 0) {
+ /* This is the node we were originally asked to delete */
+
+ if (tree->flags & TREEVIEW_DEL_EMPTY_DIRS &&
+ n->parent != NULL &&
+ n->parent->type != TREE_NODE_ROOT &&
+ n->parent->children == NULL) {
+ /* Delete empty parent */
+ nest_depth++;
+ treeview_delete_node_internal(tree, n->parent,
+ interaction);
+ nest_depth--;
+ }
+
+ /* Inform front end of change in dimensions */
+ tree->cw_t->update_size(tree->cw_h, -1, tree->root->height);
+ }
/* Free the node */
free(n);
--
NetSurf Browser