diff options
author | Owen Taylor <otaylor@redhat.com> | 2004-03-02 21:34:19 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2004-03-02 21:34:19 +0000 |
commit | d0f6b4819900f9af5e74cf7b55962d96e8645c2d (patch) | |
tree | a6df63b2ad87d0faeda85a3c8f1ec74cd0217c04 /tests/testcombochange.c | |
parent | d40c1d69f38f50c889dabebfbe9af1739ac8c95b (diff) | |
download | gtk+-d0f6b4819900f9af5e74cf7b55962d96e8645c2d.tar.gz |
gtk/gtktreestore.c (gtk_tree_store_reorder) Fix up the interpretation of
Tue Mar 2 16:18:43 2004 Owen Taylor <otaylor@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_reorder)
* gtk/gtkliststore.c (gtk_list_store_reorder): Fix
up the interpretation of new_order to match what
it means elsewhere, document the meaning of new_order.
* gtk/gtkcombobox.c (gtk_combo_box_model_rows_reordered):
Fix interpretation of new_order.
* tests/testcombochange.c (on_reorder): Fix interpretation
of new_order.
* tests/testcombochange.c (on_reorder): Fix hitting
"reorder" with an empty list.
Diffstat (limited to 'tests/testcombochange.c')
-rw-r--r-- | tests/testcombochange.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/tests/testcombochange.c b/tests/testcombochange.c index 2b94b3062f..97224b3729 100644 --- a/tests/testcombochange.c +++ b/tests/testcombochange.c @@ -146,11 +146,12 @@ on_delete (void) static void on_reorder (void) { - GArray *new_contents = g_array_new (FALSE, FALSE, sizeof (char)); - gint *shuffle_array = g_new (int, contents->len); - gint *shuffle_array_inverse = g_new (int, contents->len); + GArray *new_contents; + gint *shuffle_array; gint i; + shuffle_array = g_new (int, contents->len); + for (i = 0; i < contents->len; i++) shuffle_array[i] = i; @@ -166,19 +167,16 @@ on_reorder (void) gtk_list_store_reorder (model, shuffle_array); - for (i = 0; i < contents->len; i++) - shuffle_array_inverse[shuffle_array[i]] = i; - + new_contents = g_array_new (FALSE, FALSE, sizeof (char)); for (i = 0; i < contents->len; i++) g_array_append_val (new_contents, - g_array_index (contents, char, shuffle_array_inverse[i])); + g_array_index (contents, char, shuffle_array[i])); g_array_free (contents, TRUE); contents = new_contents; log ("Reordered array"); g_free (shuffle_array); - g_free (shuffle_array_inverse); } int |