Commit f985442a authored by Søren Sandmann's avatar Søren Sandmann Committed by Søren Sandmann Pedersen

If the item is already in the right place, don't move it. Bug #157670.

Mon Nov 29 17:51:51 2004  Søren Sandmann  <sandmann@redhat.com>

       * gtk/gtksequence.c (_gtk_sequence_sort_changed): If the item is
       already in the right place, don't move it. Bug #157670.

       * gtk/gtksequence.c (already_in_place): New function
parent f688fff6
Mon Nov 29 17:51:51 2004 Søren Sandmann <sandmann@redhat.com>
* gtk/gtksequence.c (_gtk_sequence_sort_changed): If the item is
already in the right place, don't move it. Bug #157670.
* gtk/gtksequence.c (already_in_place): New function
Mon Nov 29 17:28:53 2004 Søren Sandmann <sandmann@redhat.com>
* gtk/gtksequence.c (_gtk_sequence_sort): Take nodes in reverse
......
Mon Nov 29 17:51:51 2004 Søren Sandmann <sandmann@redhat.com>
* gtk/gtksequence.c (_gtk_sequence_sort_changed): If the item is
already in the right place, don't move it. Bug #157670.
* gtk/gtksequence.c (already_in_place): New function
Mon Nov 29 17:28:53 2004 Søren Sandmann <sandmann@redhat.com>
* gtk/gtksequence.c (_gtk_sequence_sort): Take nodes in reverse
......
Mon Nov 29 17:51:51 2004 Søren Sandmann <sandmann@redhat.com>
* gtk/gtksequence.c (_gtk_sequence_sort_changed): If the item is
already in the right place, don't move it. Bug #157670.
* gtk/gtksequence.c (already_in_place): New function
Mon Nov 29 17:28:53 2004 Søren Sandmann <sandmann@redhat.com>
* gtk/gtksequence.c (_gtk_sequence_sort): Take nodes in reverse
......
Mon Nov 29 17:51:51 2004 Søren Sandmann <sandmann@redhat.com>
* gtk/gtksequence.c (_gtk_sequence_sort_changed): If the item is
already in the right place, don't move it. Bug #157670.
* gtk/gtksequence.c (already_in_place): New function
Mon Nov 29 17:28:53 2004 Søren Sandmann <sandmann@redhat.com>
* gtk/gtksequence.c (_gtk_sequence_sort): Take nodes in reverse
......
......@@ -448,6 +448,25 @@ _gtk_sequence_ptr_move (GtkSequencePtr ptr,
return _gtk_sequence_node_find_by_pos (ptr, new_pos);
}
static gboolean
already_in_place (GtkSequencePtr ptr,
GCompareDataFunc cmp_func,
gpointer data)
{
SortInfo info;
info.cmp = cmp_func;
info.data = data;
if (node_compare (_gtk_sequence_node_prev (ptr), ptr, &info) <= 0 &&
node_compare (_gtk_sequence_node_next (ptr), ptr, &info) >= 0)
{
return TRUE;
}
return FALSE;
}
void
_gtk_sequence_sort_changed (GtkSequencePtr ptr,
GCompareDataFunc cmp_func,
......@@ -455,8 +474,12 @@ _gtk_sequence_sort_changed (GtkSequencePtr ptr,
{
GtkSequence *seq;
g_return_if_fail (ptr != NULL);
g_return_if_fail (!ptr->is_end);
if (already_in_place (ptr, cmp_func, cmp_data))
return;
seq = _gtk_sequence_node_get_sequence (ptr);
_gtk_sequence_unlink (seq, ptr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment