inspector: Add api to get the current tree walk position

This will be used in the next commit.
This commit is contained in:
Matthias Clasen 2016-03-11 13:52:09 -05:00
parent a6d575ed61
commit 2e34ce8f7c
2 changed files with 15 additions and 4 deletions

View File

@ -88,7 +88,7 @@ gtk_tree_walk_step_forward (GtkTreeWalk *walk)
if (gtk_tree_model_iter_children (walk->model, &next, &walk->position)) if (gtk_tree_model_iter_children (walk->model, &next, &walk->position))
{ {
walk->position = next; walk->position = next;
return TRUE; return TRUE;
} }
next = walk->position; next = walk->position;
@ -98,7 +98,7 @@ gtk_tree_walk_step_forward (GtkTreeWalk *walk)
if (gtk_tree_model_iter_next (walk->model, &next)) if (gtk_tree_model_iter_next (walk->model, &next))
{ {
walk->position = next; walk->position = next;
return TRUE; return TRUE;
} }
} }
while (gtk_tree_model_iter_parent (walk->model, &next, &up)); while (gtk_tree_model_iter_parent (walk->model, &next, &up));
@ -189,7 +189,7 @@ row_is_match (GtkTreeWalk *walk)
return TRUE; return TRUE;
} }
gboolean gboolean
gtk_tree_walk_next_match (GtkTreeWalk *walk, gtk_tree_walk_next_match (GtkTreeWalk *walk,
gboolean force_move, gboolean force_move,
gboolean backwards, gboolean backwards,
@ -202,7 +202,7 @@ gtk_tree_walk_next_match (GtkTreeWalk *walk,
was_visited = walk->visited; was_visited = walk->visited;
position = walk->position; position = walk->position;
do do
{ {
if (moved || (!force_move && walk->visited)) if (moved || (!force_move && walk->visited))
{ {
@ -221,3 +221,11 @@ gtk_tree_walk_next_match (GtkTreeWalk *walk,
return FALSE; return FALSE;
} }
gboolean
gtk_tree_walk_get_position (GtkTreeWalk *walk,
GtkTreeIter *iter)
{
*iter = walk->position;
return walk->visited;
}

View File

@ -39,3 +39,6 @@ gboolean gtk_tree_walk_next_match (GtkTreeWalk *walk,
gboolean force_move, gboolean force_move,
gboolean backwards, gboolean backwards,
GtkTreeIter *iter); GtkTreeIter *iter);
gboolean gtk_tree_walk_get_position (GtkTreeWalk *walk,
GtkTreeIter *iter);