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
This commit is contained in:
Søren Sandmann 2004-11-29 23:08:24 +00:00 committed by Søren Sandmann Pedersen
parent f688fff60a
commit f985442ade
5 changed files with 52 additions and 1 deletions

View File

@ -1,3 +1,10 @@
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

View File

@ -1,3 +1,10 @@
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

View File

@ -1,3 +1,10 @@
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

View File

@ -1,3 +1,10 @@
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

View File

@ -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);