summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/tree.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/tree.c b/src/tree.c
index 472e0ef..2962954 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -97,18 +97,24 @@ update_sizes(MqTree *node, gint step)
}
}
+static gboolean
+update_position(MqTree *node, gpointer user_data)
+{
+ gint *step;
+
+ step = (gint *) user_data;
+
+ node->position += *step;
+
+ return MQ_TREE_CONTINUE;
+}
+
static void
update_positions(MqTree *node, gint step)
{
- for (; node; node = node->next) {
- node->position += step;
- if (node->first_child) {
- update_positions(node->first_child, step);
- }
- if (node->parent && node->parent->next) {
- update_positions(node->parent->next, step);
- }
- }
+ print_head("Updating positions", node);
+
+ mq_tree_foreach_from(node, update_position, &step);
}
MqTree *