summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtktreeselection.c30
-rw-r--r--gtk/gtktreeselection.h1
2 files changed, 20 insertions, 11 deletions
diff --git a/gtk/gtktreeselection.c b/gtk/gtktreeselection.c
index 8c35a71ec1..c03ba7ee6c 100644
--- a/gtk/gtktreeselection.c
+++ b/gtk/gtktreeselection.c
@@ -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.
diff --git a/gtk/gtktreeselection.h b/gtk/gtktreeselection.h
index 0d9351677f..82c2c3bb7b 100644
--- a/gtk/gtktreeselection.h
+++ b/gtk/gtktreeselection.h
@@ -45,6 +45,7 @@ typedef gboolean (* GtkTreeSelectionFunc) (GtkTreeSelection *selection,
GtkTreePath *path,
gpointer data);
typedef void (* GtkTreeSelectionForeachFunc) (GtkTreeModel *model,
+ GtkTreePath *path,
GtkTreeIter *iter,
gpointer data);