summaryrefslogtreecommitdiff
path: root/gtk/gtktreemodelsort.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2005-12-29 05:26:09 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2005-12-29 05:26:09 +0000
commit4cb44fcc8fb40694f2002fcc51b56ce23b84037e (patch)
treebdf081749f6a32f27a344c0b87bfe46762ae6a5c /gtk/gtktreemodelsort.c
parentc63a3dccab99bf2f43d116a46c211a4fe35ef4b6 (diff)
downloadgtk+-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/gtktreemodelsort.c')
-rw-r--r--gtk/gtktreemodelsort.c36
1 files changed, 3 insertions, 33 deletions
diff --git a/gtk/gtktreemodelsort.c b/gtk/gtktreemodelsort.c
index 20b0f53239..d7b79f76ee 100644
--- a/gtk/gtktreemodelsort.c
+++ b/gtk/gtktreemodelsort.c
@@ -1389,43 +1389,13 @@ gtk_tree_model_sort_set_sort_func (GtkTreeSortable *sortable,
GtkDestroyNotify destroy)
{
GtkTreeModelSort *tree_model_sort = (GtkTreeModelSort *) sortable;
- GtkTreeDataSortHeader *header = NULL;
- GList *list;
g_return_if_fail (GTK_IS_TREE_MODEL_SORT (sortable));
g_return_if_fail (func != NULL);
- for (list = tree_model_sort->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_model_sort->sort_list = g_list_append (tree_model_sort->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_model_sort->sort_list = _gtk_tree_data_list_set_header (tree_model_sort->sort_list,
+ sort_column_id,
+ func, data, destroy);
if (tree_model_sort->sort_column_id == sort_column_id)
gtk_tree_model_sort_sort (tree_model_sort);