diff --git a/ChangeLog b/ChangeLog index 396e23403b..3ca35f91bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Thu Nov 1 19:11:35 2001 Jonathan Blandford + + * gtk/gtkrbtree.c (gtk_rbtree_reorder_fixup): Fix reorder_fixup, + #59583 + + * gtk/gtktreeselection.c (gtk_tree_selection_set_mode): fix + warning. + Thu Nov 1 16:54:00 2001 Owen Taylor * gtk/gtktypeutils.h: Make GtkFunction return boolean, not gint. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 396e23403b..3ca35f91bc 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,11 @@ +Thu Nov 1 19:11:35 2001 Jonathan Blandford + + * gtk/gtkrbtree.c (gtk_rbtree_reorder_fixup): Fix reorder_fixup, + #59583 + + * gtk/gtktreeselection.c (gtk_tree_selection_set_mode): fix + warning. + Thu Nov 1 16:54:00 2001 Owen Taylor * gtk/gtktypeutils.h: Make GtkFunction return boolean, not gint. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 396e23403b..3ca35f91bc 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +Thu Nov 1 19:11:35 2001 Jonathan Blandford + + * gtk/gtkrbtree.c (gtk_rbtree_reorder_fixup): Fix reorder_fixup, + #59583 + + * gtk/gtktreeselection.c (gtk_tree_selection_set_mode): fix + warning. + Thu Nov 1 16:54:00 2001 Owen Taylor * gtk/gtktypeutils.h: Make GtkFunction return boolean, not gint. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 396e23403b..3ca35f91bc 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,11 @@ +Thu Nov 1 19:11:35 2001 Jonathan Blandford + + * gtk/gtkrbtree.c (gtk_rbtree_reorder_fixup): Fix reorder_fixup, + #59583 + + * gtk/gtktreeselection.c (gtk_tree_selection_set_mode): fix + warning. + Thu Nov 1 16:54:00 2001 Owen Taylor * gtk/gtktypeutils.h: Make GtkFunction return boolean, not gint. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 396e23403b..3ca35f91bc 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,11 @@ +Thu Nov 1 19:11:35 2001 Jonathan Blandford + + * gtk/gtkrbtree.c (gtk_rbtree_reorder_fixup): Fix reorder_fixup, + #59583 + + * gtk/gtktreeselection.c (gtk_tree_selection_set_mode): fix + warning. + Thu Nov 1 16:54:00 2001 Owen Taylor * gtk/gtktypeutils.h: Make GtkFunction return boolean, not gint. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 396e23403b..3ca35f91bc 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,11 @@ +Thu Nov 1 19:11:35 2001 Jonathan Blandford + + * gtk/gtkrbtree.c (gtk_rbtree_reorder_fixup): Fix reorder_fixup, + #59583 + + * gtk/gtktreeselection.c (gtk_tree_selection_set_mode): fix + warning. + Thu Nov 1 16:54:00 2001 Owen Taylor * gtk/gtktypeutils.h: Make GtkFunction return boolean, not gint. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 396e23403b..3ca35f91bc 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,11 @@ +Thu Nov 1 19:11:35 2001 Jonathan Blandford + + * gtk/gtkrbtree.c (gtk_rbtree_reorder_fixup): Fix reorder_fixup, + #59583 + + * gtk/gtktreeselection.c (gtk_tree_selection_set_mode): fix + warning. + Thu Nov 1 16:54:00 2001 Owen Taylor * gtk/gtktypeutils.h: Make GtkFunction return boolean, not gint. diff --git a/gtk/gtkrbtree.c b/gtk/gtkrbtree.c index c07d6b4527..82768e7cfa 100644 --- a/gtk/gtkrbtree.c +++ b/gtk/gtkrbtree.c @@ -805,6 +805,7 @@ typedef struct _GtkRBReorder gint flags; gint order; gint invert_order; + gint parity; } GtkRBReorder; static int @@ -828,19 +829,26 @@ gtk_rbtree_reorder_fixup (GtkRBTree *tree, if (node == tree->nil) return; + node->parity = 1; + if (node->left != tree->nil) { gtk_rbtree_reorder_fixup (tree, node->left); node->offset += node->left->offset; + node->parity += node->left->parity; } if (node->right != tree->nil) { gtk_rbtree_reorder_fixup (tree, node->right); node->offset += node->right->offset; + node->parity += node->right->parity; } if (node->children) - node->offset += node->children->root->offset; + { + node->offset += node->children->root->offset; + node->parity += node->children->root->parity; + } } /* It basically pulls everything out of the tree, rearranges it, and puts it @@ -849,7 +857,6 @@ gtk_rbtree_reorder_fixup (GtkRBTree *tree, * heights. There is probably a more elegant way to write this function. If * anyone wants to spend the time writing it, patches will be accepted. */ - void _gtk_rbtree_reorder (GtkRBTree *tree, gint *new_order, diff --git a/gtk/gtktreeselection.c b/gtk/gtktreeselection.c index 01ec82dac3..a1f0b2be4d 100644 --- a/gtk/gtktreeselection.c +++ b/gtk/gtktreeselection.c @@ -230,7 +230,8 @@ gtk_tree_selection_set_mode (GtkTreeSelection *selection, tree, anchor_path, 0); - gtk_tree_path_free (anchor_path); + if (anchor_path) + gtk_tree_path_free (anchor_path); } selection->type = type; diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 2bdff6e049..a19cb42900 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -7987,20 +7987,32 @@ gtk_tree_view_set_reorderable (GtkTreeView *tree_view, { g_return_if_fail (GTK_IS_TREE_VIEW (tree_view)); - if (tree_view->priv->reorderable == (reorderable?TRUE:FALSE)) + reorderable = reorderable != FALSE; + + if (tree_view->priv->reorderable == reorderable) return; - gtk_tree_view_set_rows_drag_source (tree_view, - GDK_BUTTON1_MASK, - row_targets, - G_N_ELEMENTS (row_targets), - GDK_ACTION_MOVE, - NULL, NULL); - gtk_tree_view_set_rows_drag_dest (tree_view, - row_targets, - G_N_ELEMENTS (row_targets), - GDK_ACTION_MOVE, - NULL, NULL); + tree_view->priv->reorderable = reorderable; + + if (reorderable) + { + gtk_tree_view_set_rows_drag_source (tree_view, + GDK_BUTTON1_MASK, + row_targets, + G_N_ELEMENTS (row_targets), + GDK_ACTION_MOVE, + NULL, NULL); + gtk_tree_view_set_rows_drag_dest (tree_view, + row_targets, + G_N_ELEMENTS (row_targets), + GDK_ACTION_MOVE, + NULL, NULL); + } + else + { + gtk_tree_view_unset_rows_drag_source (tree_view); + gtk_tree_view_unset_rows_drag_dest (tree_view); + } g_object_notify (G_OBJECT (tree_view), "reorderable"); }