diff options
-rw-r--r-- | src/tree.c | 24 |
1 files changed, 15 insertions, 9 deletions
@@ -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 * |