+Tue Feb 26 22:22:37 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkbox.c (gtk_box_reorder_child): Clean up
+ the code so < 0 == end wasn't just a side effect,
+ remove most of the manual linked list manipulation
+ code in favor of g_list_* functions.
+
Tue Feb 26 21:44:01 2002 Owen Taylor <otaylor@redhat.com>
* config.status config.guess: Remove these files
+Tue Feb 26 22:22:37 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkbox.c (gtk_box_reorder_child): Clean up
+ the code so < 0 == end wasn't just a side effect,
+ remove most of the manual linked list manipulation
+ code in favor of g_list_* functions.
+
Tue Feb 26 21:44:01 2002 Owen Taylor <otaylor@redhat.com>
* config.status config.guess: Remove these files
+Tue Feb 26 22:22:37 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkbox.c (gtk_box_reorder_child): Clean up
+ the code so < 0 == end wasn't just a side effect,
+ remove most of the manual linked list manipulation
+ code in favor of g_list_* functions.
+
Tue Feb 26 21:44:01 2002 Owen Taylor <otaylor@redhat.com>
* config.status config.guess: Remove these files
+Tue Feb 26 22:22:37 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkbox.c (gtk_box_reorder_child): Clean up
+ the code so < 0 == end wasn't just a side effect,
+ remove most of the manual linked list manipulation
+ code in favor of g_list_* functions.
+
Tue Feb 26 21:44:01 2002 Owen Taylor <otaylor@redhat.com>
* config.status config.guess: Remove these files
+Tue Feb 26 22:22:37 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkbox.c (gtk_box_reorder_child): Clean up
+ the code so < 0 == end wasn't just a side effect,
+ remove most of the manual linked list manipulation
+ code in favor of g_list_* functions.
+
Tue Feb 26 21:44:01 2002 Owen Taylor <otaylor@redhat.com>
* config.status config.guess: Remove these files
+Tue Feb 26 22:22:37 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkbox.c (gtk_box_reorder_child): Clean up
+ the code so < 0 == end wasn't just a side effect,
+ remove most of the manual linked list manipulation
+ code in favor of g_list_* functions.
+
Tue Feb 26 21:44:01 2002 Owen Taylor <otaylor@redhat.com>
* config.status config.guess: Remove these files
+Tue Feb 26 22:22:37 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkbox.c (gtk_box_reorder_child): Clean up
+ the code so < 0 == end wasn't just a side effect,
+ remove most of the manual linked list manipulation
+ code in favor of g_list_* functions.
+
Tue Feb 26 21:44:01 2002 Owen Taylor <otaylor@redhat.com>
* config.status config.guess: Remove these files
+Tue Feb 26 22:01:59 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/tmpl/gtkbox.sgml: Fix docs to correspond to the code -
+ negative @position indicates the end of the list.
+
2002-02-26 Matthias Clasen <maclas@gmx.de>
Fixes for #72478:
A widget's position in the @box children list determines where the\r
widget is packed into @box. A child widget at some position in the\r
list will be packed just after all other widgets of the same packing\r
-type that appear earlier in the list. A negative value of @position is\r
-interpreted as position 0.\r
+type that appear earlier in the list.
</para>
@box: a #GtkBox.
@child: the #GtkWidget to move.
@position: the new position for @child in the\r
<structfield>children</structfield> list of #GtkBox-struct, starting\r
-from 0.
+from 0. If negative, indicates the end of the list.
<!-- ##### FUNCTION gtk_box_query_child_packing ##### -->
GtkWidget *child,
gint position)
{
- GList *list;
+ GList *old_link;
+ GList *new_link;
+ GtkBoxChild *child_info = NULL;
+ gint old_position;
g_return_if_fail (GTK_IS_BOX (box));
g_return_if_fail (GTK_IS_WIDGET (child));
- list = box->children;
- while (list)
+ old_link = box->children;
+ old_position = 0;
+ while (old_link)
{
- GtkBoxChild *child_info;
-
- child_info = list->data;
+ child_info = old_link->data;
if (child_info->widget == child)
break;
- list = list->next;
+ old_link = old_link->next;
+ old_position++;
}
- if (list && box->children->next)
- {
- GList *tmp_list;
+ g_return_if_fail (old_link != NULL);
- if (list->next)
- list->next->prev = list->prev;
- if (list->prev)
- list->prev->next = list->next;
- else
- box->children = list->next;
+ if (position == old_position)
+ return;
- tmp_list = box->children;
- while (position && tmp_list->next)
- {
- position--;
- tmp_list = tmp_list->next;
- }
+ box->children = g_list_delete_link (box->children, old_link);
- if (position)
- {
- tmp_list->next = list;
- list->prev = tmp_list;
- list->next = NULL;
- }
- else
- {
- if (tmp_list->prev)
- tmp_list->prev->next = list;
- else
- box->children = list;
- list->prev = tmp_list->prev;
- tmp_list->prev = list;
- list->next = tmp_list;
- }
+ if (position < 0)
+ new_link = NULL;
+ else
+ new_link = g_list_nth (box->children, position);
- gtk_widget_child_notify (child, "position");
- if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (box))
- gtk_widget_queue_resize (child);
- }
+ box->children = g_list_insert_before (box->children, new_link, child_info);
+
+ gtk_widget_child_notify (child, "position");
+ if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (box))
+ gtk_widget_queue_resize (child);
}
void