diff options
author | Matthias Clasen <mclasen@redhat.com> | 2005-12-29 05:26:09 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2005-12-29 05:26:09 +0000 |
commit | 4cb44fcc8fb40694f2002fcc51b56ce23b84037e (patch) | |
tree | bdf081749f6a32f27a344c0b87bfe46762ae6a5c /gtk/gtktreestore.c | |
parent | c63a3dccab99bf2f43d116a46c211a4fe35ef4b6 (diff) | |
download | gtk+-4cb44fcc8fb40694f2002fcc51b56ce23b84037e.tar.gz |
Use the slice allocater for GtkTreeDataSortHeader.
2005-12-29 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktreedatalist.c: Use the slice allocater for
GtkTreeDataSortHeader.
* gtk/gtktreedatalist.h:
* gtk/gtktreedatalist.c (_gtk_tree_data_list_set_header): New function.
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_sort_func):
* gtk/gtkliststore.c (gtk_list_store_set_sort_func):
* gtk/gtktreestore.c (gtk_tree_store_set_sort_func): Use it here.
Diffstat (limited to 'gtk/gtktreestore.c')
-rw-r--r-- | gtk/gtktreestore.c | 41 |
1 files changed, 7 insertions, 34 deletions
diff --git a/gtk/gtktreestore.c b/gtk/gtktreestore.c index 914997ad79..1569fc273e 100644 --- a/gtk/gtktreestore.c +++ b/gtk/gtktreestore.c @@ -2674,7 +2674,8 @@ gtk_tree_store_sort (GtkTreeStore *tree_store) { GtkTreeDataSortHeader *header = NULL; - header = _gtk_tree_data_list_get_header (tree_store->sort_list, tree_store->sort_column_id); + header = _gtk_tree_data_list_get_header (tree_store->sort_list, + tree_store->sort_column_id); /* We want to make sure that we have a function */ g_return_if_fail (header != NULL); @@ -2919,7 +2920,8 @@ gtk_tree_store_set_sort_column_id (GtkTreeSortable *sortable, { 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); @@ -2947,42 +2949,13 @@ gtk_tree_store_set_sort_func (GtkTreeSortable *sortable, GtkDestroyNotify destroy) { GtkTreeStore *tree_store = (GtkTreeStore *) sortable; - GtkTreeDataSortHeader *header = NULL; - GList *list; g_return_if_fail (GTK_IS_TREE_STORE (sortable)); g_return_if_fail (func != NULL); - for (list = tree_store->sort_list; list; list = list->next) - { - GtkTreeDataSortHeader *list_header; - - list_header = (GtkTreeDataSortHeader*) list->data; - if (list_header->sort_column_id == sort_column_id) - { - header = list_header; - break; - } - } - - if (header == NULL) - { - header = g_new0 (GtkTreeDataSortHeader, 1); - header->sort_column_id = sort_column_id; - tree_store->sort_list = g_list_append (tree_store->sort_list, header); - } - - if (header->destroy) - { - GtkDestroyNotify d = header->destroy; - - header->destroy = NULL; - d (header->data); - } - - header->func = func; - header->data = data; - header->destroy = destroy; + tree_store->sort_list = _gtk_tree_data_list_set_header (tree_store->sort_list, + sort_column_id, + func, data, destroy); if (tree_store->sort_column_id == sort_column_id) gtk_tree_store_sort (tree_store); |