add path argument to selection callbacks.

Fri Jun 29 03:14:16 2001  Jonathan Blandford  <jrb@redhat.com>

	* gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach):
	add path argument to selection callbacks.
This commit is contained in:
Jonathan Blandford 2001-06-29 07:28:08 +00:00 committed by Jonathan Blandford
parent db93c6131e
commit 1bbcf0394f
9 changed files with 55 additions and 11 deletions

View File

@ -1,3 +1,8 @@
Fri Jun 29 03:14:16 2001 Jonathan Blandford <jrb@webwynk.net>
* gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach):
add path argument to selection callbacks.
Fri Jun 29 00:13:34 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_model_foreach): New function to

View File

@ -1,3 +1,8 @@
Fri Jun 29 03:14:16 2001 Jonathan Blandford <jrb@webwynk.net>
* gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach):
add path argument to selection callbacks.
Fri Jun 29 00:13:34 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_model_foreach): New function to

View File

@ -1,3 +1,8 @@
Fri Jun 29 03:14:16 2001 Jonathan Blandford <jrb@webwynk.net>
* gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach):
add path argument to selection callbacks.
Fri Jun 29 00:13:34 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_model_foreach): New function to

View File

@ -1,3 +1,8 @@
Fri Jun 29 03:14:16 2001 Jonathan Blandford <jrb@webwynk.net>
* gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach):
add path argument to selection callbacks.
Fri Jun 29 00:13:34 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_model_foreach): New function to

View File

@ -1,3 +1,8 @@
Fri Jun 29 03:14:16 2001 Jonathan Blandford <jrb@webwynk.net>
* gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach):
add path argument to selection callbacks.
Fri Jun 29 00:13:34 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_model_foreach): New function to

View File

@ -1,3 +1,8 @@
Fri Jun 29 03:14:16 2001 Jonathan Blandford <jrb@webwynk.net>
* gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach):
add path argument to selection callbacks.
Fri Jun 29 00:13:34 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_model_foreach): New function to

View File

@ -1,3 +1,8 @@
Fri Jun 29 03:14:16 2001 Jonathan Blandford <jrb@webwynk.net>
* gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach):
add path argument to selection callbacks.
Fri Jun 29 00:13:34 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_model_foreach): New function to

View File

@ -386,14 +386,19 @@ gtk_tree_selection_selected_foreach (GtkTreeSelection *selection,
if (selection->type == GTK_TREE_SELECTION_SINGLE)
{
if (gtk_tree_selection_get_selected (selection, NULL, &iter))
(* func) (selection->tree_view->priv->model, &iter, data);
if (gtk_tree_row_reference_valid (selection->tree_view->priv->anchor))
{
path = gtk_tree_row_reference_get_path (selection->tree_view->priv->anchor);
gtk_tree_model_get_iter (selection->tree_view->priv->model, &iter, path);
(* func) (selection->tree_view->priv->model, path, &iter, data);
gtk_tree_path_free (path);
}
return;
}
tree = selection->tree_view->priv->tree;
node = selection->tree_view->priv->tree->root;
while (node->left != tree->nil)
node = node->left;
@ -401,12 +406,11 @@ gtk_tree_selection_selected_foreach (GtkTreeSelection *selection,
path = gtk_tree_path_new_root ();
gtk_tree_model_get_iter (selection->tree_view->priv->model,
&iter, path);
gtk_tree_path_free (path);
do
{
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED))
(* func) (selection->tree_view->priv->model, &iter, data);
(* func) (selection->tree_view->priv->model, path, &iter, data);
if (node->children)
{
gboolean has_child;
@ -418,7 +422,7 @@ gtk_tree_selection_selected_foreach (GtkTreeSelection *selection,
node = node->left;
tmp = iter;
has_child = gtk_tree_model_iter_children (selection->tree_view->priv->model, &iter, &tmp);
gtk_tree_path_append_index (path, 0);
/* Sanity Check! */
TREE_VIEW_INTERNAL_ASSERT_VOID (has_child);
}
@ -434,6 +438,7 @@ gtk_tree_selection_selected_foreach (GtkTreeSelection *selection,
has_next = gtk_tree_model_iter_next (selection->tree_view->priv->model, &iter);
done = TRUE;
gtk_tree_path_next (path);
/* Sanity Check! */
TREE_VIEW_INTERNAL_ASSERT_VOID (has_next);
@ -446,11 +451,14 @@ gtk_tree_selection_selected_foreach (GtkTreeSelection *selection,
node = tree->parent_node;
tree = tree->parent_tree;
if (tree == NULL)
/* we've run out of tree */
/* We're done with this function */
return;
{
gtk_tree_path_free (path);
/* we've run out of tree */
/* We're done with this function */
return;
}
has_parent = gtk_tree_model_iter_parent (selection->tree_view->priv->model, &iter, &tmp_iter);
gtk_tree_path_up (path);
/* Sanity check */
TREE_VIEW_INTERNAL_ASSERT_VOID (has_parent);
}
@ -877,7 +885,7 @@ gtk_tree_selection_select_range (GtkTreeSelection *selection,
g_return_if_fail (selection->tree_view != NULL);
if (gtk_tree_selection_real_select_range (selection, start_path, end_path))
gtk_signal_emit (G_OBJECT (selection), tree_selection_signals[CHANGED], 0);
g_signal_emit (G_OBJECT (selection), tree_selection_signals[CHANGED], 0);
}
/* Called internally by gtktreeview.c It handles actually selecting the tree.

View File

@ -45,6 +45,7 @@ typedef gboolean (* GtkTreeSelectionFunc) (GtkTreeSelection *selection,
GtkTreePath *path,
gpointer data);
typedef void (* GtkTreeSelectionForeachFunc) (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
gpointer data);