Fix signed-unsigned error that was accidentally causing negative values to

Fri Mar  1 10:31:14 2002  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtknotebook.c (gtk_notebook_reorder_child):
	Fix signed-unsigned error that was accidentally causing
	negative values to append, do it intentionally. Fix docs
	to say that negative values append. (Alexey A. Malyshev,
	#73108)
This commit is contained in:
Owen Taylor 2002-03-01 15:41:59 +00:00 committed by Owen Taylor
parent 3098a031d6
commit f4c06611fd
8 changed files with 65 additions and 4 deletions

View File

@ -1,3 +1,11 @@
Fri Mar 1 10:31:14 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_reorder_child):
Fix signed-unsigned error that was accidentally causing
negative values to append, do it intentionally. Fix docs
to say that negative values append. (Alexey A. Malyshev,
#73108)
2002-03-01 Alexey Malyshev <maa@sparc.spb.su>
* gtk+/gtk/gtkitemfactory.c

View File

@ -1,3 +1,11 @@
Fri Mar 1 10:31:14 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_reorder_child):
Fix signed-unsigned error that was accidentally causing
negative values to append, do it intentionally. Fix docs
to say that negative values append. (Alexey A. Malyshev,
#73108)
2002-03-01 Alexey Malyshev <maa@sparc.spb.su>
* gtk+/gtk/gtkitemfactory.c

View File

@ -1,3 +1,11 @@
Fri Mar 1 10:31:14 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_reorder_child):
Fix signed-unsigned error that was accidentally causing
negative values to append, do it intentionally. Fix docs
to say that negative values append. (Alexey A. Malyshev,
#73108)
2002-03-01 Alexey Malyshev <maa@sparc.spb.su>
* gtk+/gtk/gtkitemfactory.c

View File

@ -1,3 +1,11 @@
Fri Mar 1 10:31:14 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_reorder_child):
Fix signed-unsigned error that was accidentally causing
negative values to append, do it intentionally. Fix docs
to say that negative values append. (Alexey A. Malyshev,
#73108)
2002-03-01 Alexey Malyshev <maa@sparc.spb.su>
* gtk+/gtk/gtkitemfactory.c

View File

@ -1,3 +1,11 @@
Fri Mar 1 10:31:14 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_reorder_child):
Fix signed-unsigned error that was accidentally causing
negative values to append, do it intentionally. Fix docs
to say that negative values append. (Alexey A. Malyshev,
#73108)
2002-03-01 Alexey Malyshev <maa@sparc.spb.su>
* gtk+/gtk/gtkitemfactory.c

View File

@ -1,3 +1,11 @@
Fri Mar 1 10:31:14 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_reorder_child):
Fix signed-unsigned error that was accidentally causing
negative values to append, do it intentionally. Fix docs
to say that negative values append. (Alexey A. Malyshev,
#73108)
2002-03-01 Alexey Malyshev <maa@sparc.spb.su>
* gtk+/gtk/gtkitemfactory.c

View File

@ -1,3 +1,11 @@
Fri Mar 1 10:31:14 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_reorder_child):
Fix signed-unsigned error that was accidentally causing
negative values to append, do it intentionally. Fix docs
to say that negative values append. (Alexey A. Malyshev,
#73108)
2002-03-01 Alexey Malyshev <maa@sparc.spb.su>
* gtk+/gtk/gtkitemfactory.c

View File

@ -5010,10 +5010,12 @@ gtk_notebook_query_tab_label_packing (GtkNotebook *notebook,
* gtk_notebook_reorder_child:
* @notebook: a #GtkNotebook
* @child: the child to move
* @position: the new position
* @position: the new position, or -1 to move to the end
*
* Reorders the page containing @child, so that it appears in position
* @position. Out of bounds @position will be clamped.
* @position. If @position is greater than or equal to the number of
* children in the list or negative, @child will be moved to the end
* of the list.
**/
void
gtk_notebook_reorder_child (GtkNotebook *notebook,
@ -5023,6 +5025,7 @@ gtk_notebook_reorder_child (GtkNotebook *notebook,
GList *list, *new_list;
GtkNotebookPage *page;
gint old_pos;
gint max_pos;
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
g_return_if_fail (GTK_IS_WIDGET (child));
@ -5031,6 +5034,10 @@ gtk_notebook_reorder_child (GtkNotebook *notebook,
if (!list)
return;
max_pos = g_list_length (notebook->children) - 1;
if (position < 0 || position > max_pos)
position = max_pos;
old_pos = g_list_position (notebook->children, list);
if (old_pos == position)
@ -5039,8 +5046,6 @@ gtk_notebook_reorder_child (GtkNotebook *notebook,
page = list->data;
notebook->children = g_list_delete_link (notebook->children, list);
position = CLAMP (position, 0, g_list_length (notebook->children));
notebook->children = g_list_insert (notebook->children, page, position);
new_list = g_list_nth (notebook->children, position);