]> Pileus Git - ~andy/gtk/commitdiff
Fix signed-unsigned error that was accidentally causing negative values to
authorOwen Taylor <otaylor@redhat.com>
Fri, 1 Mar 2002 15:41:59 +0000 (15:41 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Fri, 1 Mar 2002 15:41:59 +0000 (15:41 +0000)
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)

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtknotebook.c

index 438c9ba703fc30ed78999a406c8b236f08c66fd5..9e7d3b8bdb5731239d2f10f3fe089f0215b93164 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 438c9ba703fc30ed78999a406c8b236f08c66fd5..9e7d3b8bdb5731239d2f10f3fe089f0215b93164 100644 (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
index 438c9ba703fc30ed78999a406c8b236f08c66fd5..9e7d3b8bdb5731239d2f10f3fe089f0215b93164 100644 (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
index 438c9ba703fc30ed78999a406c8b236f08c66fd5..9e7d3b8bdb5731239d2f10f3fe089f0215b93164 100644 (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
index 438c9ba703fc30ed78999a406c8b236f08c66fd5..9e7d3b8bdb5731239d2f10f3fe089f0215b93164 100644 (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
index 438c9ba703fc30ed78999a406c8b236f08c66fd5..9e7d3b8bdb5731239d2f10f3fe089f0215b93164 100644 (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
index 438c9ba703fc30ed78999a406c8b236f08c66fd5..9e7d3b8bdb5731239d2f10f3fe089f0215b93164 100644 (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
index fd6d01cbc016a673d8c9d959328f85eb6bafdb87..7596a6cd324c213dde3ae5e36d08ae149233b0bb 100644 (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);