+
+static void
+expand_open_links (GtkTreeView *tree_view, GtkTreeModel *model, GtkTreeIter *parent)
+{
+ GtkTreeIter iter;
+ EvLink *link;
+ gboolean expand;
+
+ if (gtk_tree_model_iter_children (model, &iter, parent)) {
+ do {
+ gtk_tree_model_get (model, &iter,
+ EV_DOCUMENT_LINKS_COLUMN_LINK, &link,
+ EV_DOCUMENT_LINKS_COLUMN_EXPAND, &expand,
+ -1);
+ if (expand) {
+ GtkTreePath *path;
+
+ path = gtk_tree_model_get_path (model, &iter);
+ gtk_tree_view_expand_row (tree_view, path, FALSE);
+ gtk_tree_path_free (path);
+ }
+
+ expand_open_links (tree_view, model, &iter);
+ } while (gtk_tree_model_iter_next (model, &iter));
+ }
+}
+