diff options
author | Matthias Clasen <maclas@gmx.de> | 2004-09-05 05:06:05 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2004-09-05 05:06:05 +0000 |
commit | 71e3cae54c1420ab3a0d655243f0867e789fdbd7 (patch) | |
tree | a8f165a2cfbe8a0e488379c68147219edadf2a0e /gtk/gtktreestore.c | |
parent | 44bfacfc5f51ed45030fbf380e36775000f9210f (diff) | |
download | gtk+-71e3cae54c1420ab3a0d655243f0867e789fdbd7.tar.gz |
Allow sorting of tree models to be turned off again. (#151139, Torsten
Sun Sep 5 01:04:01 2004 Matthias Clasen <maclas@gmx.de>
Allow sorting of tree models to be turned off
again. (#151139, Torsten Schoenfeld)
* gtk/gtktreesortable.h:
Add GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID.
* gtk/gtktreestore.c (gtk_tree_store_sort):
* gtk/gtkliststore.c (gtk_list_store_sort): Don't sort if
the list store is not sorted.
Diffstat (limited to 'gtk/gtktreestore.c')
-rw-r--r-- | gtk/gtktreestore.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/gtk/gtktreestore.c b/gtk/gtktreestore.c index b3e2409953..c8cc9cd1fb 100644 --- a/gtk/gtktreestore.c +++ b/gtk/gtktreestore.c @@ -27,7 +27,7 @@ #include "gtktreednd.h" #define G_NODE(node) ((GNode *)node) -#define GTK_TREE_STORE_IS_SORTED(tree) (GTK_TREE_STORE (tree)->sort_column_id != -2) +#define GTK_TREE_STORE_IS_SORTED(tree) (GTK_TREE_STORE (tree)->sort_column_id != GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID) #define VALID_ITER(iter, tree_store) (iter!= NULL && iter->user_data != NULL && tree_store->stamp == iter->stamp) static void gtk_tree_store_init (GtkTreeStore *tree_store); @@ -2555,8 +2555,6 @@ gtk_tree_store_sort_helper (GtkTreeStore *tree_store, return; } - g_assert (GTK_TREE_STORE_IS_SORTED (tree_store)); - list_length = 0; for (tmp_node = node; tmp_node; tmp_node = tmp_node->next) list_length++; @@ -2615,6 +2613,9 @@ gtk_tree_store_sort_helper (GtkTreeStore *tree_store, static void gtk_tree_store_sort (GtkTreeStore *tree_store) { + if (!GTK_TREE_STORE_IS_SORTED (tree_store)) + return; + if (tree_store->sort_column_id != -1) { GtkTreeDataSortHeader *header = NULL; @@ -2857,19 +2858,22 @@ gtk_tree_store_set_sort_column_id (GtkTreeSortable *sortable, (tree_store->order == order)) return; - if (sort_column_id != GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID) + if (sort_column_id != GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID) { - GtkTreeDataSortHeader *header = NULL; + if (sort_column_id != GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID) + { + GtkTreeDataSortHeader *header = NULL; - header = _gtk_tree_data_list_get_header (tree_store->sort_list, sort_column_id); + header = _gtk_tree_data_list_get_header (tree_store->sort_list, sort_column_id); - /* We want to make sure that we have a function */ - g_return_if_fail (header != NULL); - g_return_if_fail (header->func != NULL); - } - else - { - g_return_if_fail (tree_store->default_sort_func != NULL); + /* We want to make sure that we have a function */ + g_return_if_fail (header != NULL); + g_return_if_fail (header->func != NULL); + } + else + { + g_return_if_fail (tree_store->default_sort_func != NULL); + } } tree_store->sort_column_id = sort_column_id; |