Use the new order correctly. Patch by Li Yuan

* gtk/gtkiconview.c (gtk_icon_view_accessible_model_rows_reordered):
        Use the new order correctly.  Patch by Li Yuan


svn path=/trunk/; revision=21878
This commit is contained in:
Matthias Clasen 2008-12-13 05:28:21 +00:00
parent 1934d3423b
commit 82cdd4b903
2 changed files with 18 additions and 1 deletions

View File

@ -1,3 +1,11 @@
2008-12-13 Matthias Clasen <mclasen@redhat.com>
Bug 564212 gtk_icon_view_accessible_model_rows_reordered explain
new_order in the wrong way
* gtk/gtkiconview.c (gtk_icon_view_accessible_model_rows_reordered):
Use the new order correctly. Patch by Li Yuan
2008-12-13 Matthias Clasen <mclasen@redhat.com> 2008-12-13 Matthias Clasen <mclasen@redhat.com>
Bug 563835 Typo in gtk_widget_has_screen() docs Bug 563835 Typo in gtk_widget_has_screen() docs

View File

@ -9003,20 +9003,29 @@ gtk_icon_view_accessible_model_rows_reordered (GtkTreeModel *tree_model,
GtkIconViewItemAccessible *item; GtkIconViewItemAccessible *item;
GList *items; GList *items;
AtkObject *atk_obj; AtkObject *atk_obj;
gint *order;
gint length, i;
atk_obj = gtk_widget_get_accessible (GTK_WIDGET (user_data)); atk_obj = gtk_widget_get_accessible (GTK_WIDGET (user_data));
icon_view = GTK_ICON_VIEW (user_data); icon_view = GTK_ICON_VIEW (user_data);
priv = gtk_icon_view_accessible_get_priv (atk_obj); priv = gtk_icon_view_accessible_get_priv (atk_obj);
length = gtk_tree_model_iter_n_children (tree_model, NULL);
order = g_new (gint, length);
for (i = 0; i < length; i++)
order [new_order[i]] = i;
items = priv->items; items = priv->items;
while (items) while (items)
{ {
info = items->data; info = items->data;
item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (info->item); item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (info->item);
info->index = new_order[info->index]; info->index = order[info->index];
item->item = g_list_nth_data (icon_view->priv->items, info->index); item->item = g_list_nth_data (icon_view->priv->items, info->index);
items = items->next; items = items->next;
} }
g_free (order);
priv->items = g_list_sort (priv->items, priv->items = g_list_sort (priv->items,
(GCompareFunc)gtk_icon_view_accessible_item_compare); (GCompareFunc)gtk_icon_view_accessible_item_compare);