summaryrefslogtreecommitdiff
path: root/gtk/gtktreeselection.c
diff options
context:
space:
mode:
authorJonathan Blandford <jrb@redhat.com>2002-01-10 00:11:32 +0000
committerJonathan Blandford <jrb@src.gnome.org>2002-01-10 00:11:32 +0000
commited50ebfb28e7a04ca4236f7bf2deaf43f1b3d579 (patch)
tree4e0a286855364bfcad42f02d014ddee7cd11c22b /gtk/gtktreeselection.c
parentb99088974ebac97cbe8721c863cb248fdd056c86 (diff)
downloadgtk+-ed50ebfb28e7a04ca4236f7bf2deaf43f1b3d579.tar.gz
Now we test we can unselect nodes before selecting new ones.
Wed Jan 9 19:10:07 2002 Jonathan Blandford <jrb@redhat.com> * gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node): Now we test we can unselect nodes before selecting new ones. (gtk_tree_selection_real_select_node): be careful comparing booleans.
Diffstat (limited to 'gtk/gtktreeselection.c')
-rw-r--r--gtk/gtktreeselection.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/gtk/gtktreeselection.c b/gtk/gtktreeselection.c
index 3d21d3474c..54ef4c8d45 100644
--- a/gtk/gtktreeselection.c
+++ b/gtk/gtktreeselection.c
@@ -994,12 +994,30 @@ _gtk_tree_selection_internal_select_node (GtkTreeSelection *selection,
}
else
{
- /* FIXME: We only want to select the new node if we can unselect the
- * old one, and we can select the new one. We are currently
- * unselecting the old one first, then trying the new one. */
if (anchor_path)
{
- dirty = gtk_tree_selection_real_unselect_all (selection);
+ /* We only want to select the new node if we can unselect the old one,
+ * and we can select the new one. */
+ if (selection->user_func)
+ {
+ if ((*selection->user_func) (selection, selection->tree_view->priv->model, path,
+ GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED),
+ selection->user_data))
+ dirty = TRUE;
+ }
+ else
+ {
+ dirty = TRUE;
+ }
+
+ /* if dirty is FALSE, we weren't able to select the new one, otherwise, we try to
+ * unselect the new one
+ */
+ if (dirty)
+ dirty = gtk_tree_selection_real_unselect_all (selection);
+
+ /* if dirty is TRUE at this point, we successfully unselected the
+ * old one, and can then select the new one */
if (dirty)
{
if (selection->tree_view->priv->anchor)
@@ -1093,6 +1111,8 @@ gtk_tree_selection_real_select_node (GtkTreeSelection *selection,
gboolean selected = FALSE;
GtkTreePath *path = NULL;
+ select = !! select;
+
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED) != select)
{
path = _gtk_tree_view_find_path (selection->tree_view, tree, node);