//------------------------------------------------------------------------------
Gtk::TreeModel::Path node2path(const ::bec::NodeId& node) {
  const int depth = node.depth();
  Gtk::TreeModel::Path path;

  for (int i = 0; i < depth; i++)
    path.push_back(node[i]);

  return path;
}
//------------------------------------------------------------------------------
Gtk::TreeModel::Path ListModelWrapper::get_path_vfunc(const iterator& iter) const {
  const bec::NodeId node = node_for_iter(iter);
  Gtk::TreeModel::Path path;

  if (node.is_valid()) {
    const int node_depth = node.depth();

    for (int i = 0; i < node_depth; i++)
      path.push_back(node[i]);
  }

  return path;
}
Gtk::TreeModel::Path TreeModelWrapper::get_path_vfunc(const iterator& iter) const {
  bec::NodeId node = node_for_iter(iter);
  Gtk::TreeModel::Path path;

  if (node.is_valid()) {
    const int node_depth = node.depth();

    // get path from an iterator. The iterator points to the node, so
    // we have to trim the root node prefix so we have a path to the tree
    for (int i = bec::NodeId(_root_node_path).depth(); i < node_depth; i++)
      path.push_back(node[i]);
  }
  return path;
}