GitLab repository storage has been migrated to hashed layout. Please contact Infrastructure team if you notice any issues with repositories or hooks.

Commit 67f8b5bd authored by Jonathan Blandford's avatar Jonathan Blandford Committed by Jonathan Blandford

Rename gtk_tree_sortable_sort_column_id_set_func. It's much shorter now.


Fri Jun 15 18:53:48 2001  Jonathan Blandford  <jrb@redhat.com>

	* gtk/gtktreesortable.c (gtk_tree_sortable_set_sort_func): Rename
	gtk_tree_sortable_sort_column_id_set_func.  It's much shorter now.
	* gtk/gtktreeview.c (gtk_tree_view_sort_iter_changed): WOOO!!!
	Now I can really reorder/sort all Store widgets.  treesorttest
	seems to just work now.
	* gtk/gtklistview.c (gtk_list_store_iter_changed): Whoops.
	testtreesort worked through a big coincidence all this time.
	* gtk/gtkrbtree.c (_gtk_rbtree_reorder): Nasty bug fix in nasty
	code.
	* tests/testtreecolumns.c: Big 'ol warning at the top letting
	people know that this code should never ever ever be copied.

HA!

While everyone else was busy flaming eash other over configuration
engines, I secretly got sorting completely working with store widgets
and GtkTreeView.  GtkTreeModelSort, here I come!!!!!
parent 6adcae81
Fri Jun 15 18:53:48 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreesortable.c (gtk_tree_sortable_set_sort_func): Rename
gtk_tree_sortable_sort_column_id_set_func. It's much shorter now.
* gtk/gtktreeview.c (gtk_tree_view_sort_iter_changed): WOOO!!!
Now I can really reorder/sort all Store widgets. treesorttest
seems to just work now.
* gtk/gtklistview.c (gtk_list_store_iter_changed): Whoops.
testtreesort worked through a big coincidence all this time.
* gtk/gtkrbtree.c (_gtk_rbtree_reorder): Nasty bug fix in nasty
code.
* tests/testtreecolumns.c: Big 'ol warning at the top letting
people know that this code should never ever ever be copied.
2001-06-15 Jonas Borgstrm <jonas@codefactory.se> 2001-06-15 Jonas Borgstrm <jonas@codefactory.se>
* gtk/gtkwindow.h: Fixed a small typo, it should be * gtk/gtkwindow.h: Fixed a small typo, it should be
......
Fri Jun 15 18:53:48 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreesortable.c (gtk_tree_sortable_set_sort_func): Rename
gtk_tree_sortable_sort_column_id_set_func. It's much shorter now.
* gtk/gtktreeview.c (gtk_tree_view_sort_iter_changed): WOOO!!!
Now I can really reorder/sort all Store widgets. treesorttest
seems to just work now.
* gtk/gtklistview.c (gtk_list_store_iter_changed): Whoops.
testtreesort worked through a big coincidence all this time.
* gtk/gtkrbtree.c (_gtk_rbtree_reorder): Nasty bug fix in nasty
code.
* tests/testtreecolumns.c: Big 'ol warning at the top letting
people know that this code should never ever ever be copied.
2001-06-15 Jonas Borgstrm <jonas@codefactory.se> 2001-06-15 Jonas Borgstrm <jonas@codefactory.se>
* gtk/gtkwindow.h: Fixed a small typo, it should be * gtk/gtkwindow.h: Fixed a small typo, it should be
......
Fri Jun 15 18:53:48 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreesortable.c (gtk_tree_sortable_set_sort_func): Rename
gtk_tree_sortable_sort_column_id_set_func. It's much shorter now.
* gtk/gtktreeview.c (gtk_tree_view_sort_iter_changed): WOOO!!!
Now I can really reorder/sort all Store widgets. treesorttest
seems to just work now.
* gtk/gtklistview.c (gtk_list_store_iter_changed): Whoops.
testtreesort worked through a big coincidence all this time.
* gtk/gtkrbtree.c (_gtk_rbtree_reorder): Nasty bug fix in nasty
code.
* tests/testtreecolumns.c: Big 'ol warning at the top letting
people know that this code should never ever ever be copied.
2001-06-15 Jonas Borgstrm <jonas@codefactory.se> 2001-06-15 Jonas Borgstrm <jonas@codefactory.se>
* gtk/gtkwindow.h: Fixed a small typo, it should be * gtk/gtkwindow.h: Fixed a small typo, it should be
......
Fri Jun 15 18:53:48 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreesortable.c (gtk_tree_sortable_set_sort_func): Rename
gtk_tree_sortable_sort_column_id_set_func. It's much shorter now.
* gtk/gtktreeview.c (gtk_tree_view_sort_iter_changed): WOOO!!!
Now I can really reorder/sort all Store widgets. treesorttest
seems to just work now.
* gtk/gtklistview.c (gtk_list_store_iter_changed): Whoops.
testtreesort worked through a big coincidence all this time.
* gtk/gtkrbtree.c (_gtk_rbtree_reorder): Nasty bug fix in nasty
code.
* tests/testtreecolumns.c: Big 'ol warning at the top letting
people know that this code should never ever ever be copied.
2001-06-15 Jonas Borgstrm <jonas@codefactory.se> 2001-06-15 Jonas Borgstrm <jonas@codefactory.se>
* gtk/gtkwindow.h: Fixed a small typo, it should be * gtk/gtkwindow.h: Fixed a small typo, it should be
......
Fri Jun 15 18:53:48 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreesortable.c (gtk_tree_sortable_set_sort_func): Rename
gtk_tree_sortable_sort_column_id_set_func. It's much shorter now.
* gtk/gtktreeview.c (gtk_tree_view_sort_iter_changed): WOOO!!!
Now I can really reorder/sort all Store widgets. treesorttest
seems to just work now.
* gtk/gtklistview.c (gtk_list_store_iter_changed): Whoops.
testtreesort worked through a big coincidence all this time.
* gtk/gtkrbtree.c (_gtk_rbtree_reorder): Nasty bug fix in nasty
code.
* tests/testtreecolumns.c: Big 'ol warning at the top letting
people know that this code should never ever ever be copied.
2001-06-15 Jonas Borgstrm <jonas@codefactory.se> 2001-06-15 Jonas Borgstrm <jonas@codefactory.se>
* gtk/gtkwindow.h: Fixed a small typo, it should be * gtk/gtkwindow.h: Fixed a small typo, it should be
......
Fri Jun 15 18:53:48 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreesortable.c (gtk_tree_sortable_set_sort_func): Rename
gtk_tree_sortable_sort_column_id_set_func. It's much shorter now.
* gtk/gtktreeview.c (gtk_tree_view_sort_iter_changed): WOOO!!!
Now I can really reorder/sort all Store widgets. treesorttest
seems to just work now.
* gtk/gtklistview.c (gtk_list_store_iter_changed): Whoops.
testtreesort worked through a big coincidence all this time.
* gtk/gtkrbtree.c (_gtk_rbtree_reorder): Nasty bug fix in nasty
code.
* tests/testtreecolumns.c: Big 'ol warning at the top letting
people know that this code should never ever ever be copied.
2001-06-15 Jonas Borgstrm <jonas@codefactory.se> 2001-06-15 Jonas Borgstrm <jonas@codefactory.se>
* gtk/gtkwindow.h: Fixed a small typo, it should be * gtk/gtkwindow.h: Fixed a small typo, it should be
......
Fri Jun 15 18:53:48 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreesortable.c (gtk_tree_sortable_set_sort_func): Rename
gtk_tree_sortable_sort_column_id_set_func. It's much shorter now.
* gtk/gtktreeview.c (gtk_tree_view_sort_iter_changed): WOOO!!!
Now I can really reorder/sort all Store widgets. treesorttest
seems to just work now.
* gtk/gtklistview.c (gtk_list_store_iter_changed): Whoops.
testtreesort worked through a big coincidence all this time.
* gtk/gtkrbtree.c (_gtk_rbtree_reorder): Nasty bug fix in nasty
code.
* tests/testtreecolumns.c: Big 'ol warning at the top letting
people know that this code should never ever ever be copied.
2001-06-15 Jonas Borgstrm <jonas@codefactory.se> 2001-06-15 Jonas Borgstrm <jonas@codefactory.se>
* gtk/gtkwindow.h: Fixed a small typo, it should be * gtk/gtkwindow.h: Fixed a small typo, it should be
......
...@@ -81,21 +81,21 @@ static gboolean gtk_list_store_row_drop_possible (GtkTreeDragDest *drag_dest, ...@@ -81,21 +81,21 @@ static gboolean gtk_list_store_row_drop_possible (GtkTreeDragDest *drag_dest,
/* sortable */ /* sortable */
static void gtk_list_store_sort (GtkListStore *list_store); static void gtk_list_store_sort (GtkListStore *list_store);
static void gtk_list_store_sort_iter_changed (GtkListStore *list_store, static void gtk_list_store_sort_iter_changed (GtkListStore *list_store,
GtkTreeIter *iter, GtkTreeIter *iter,
gint column); gint column);
static gboolean gtk_list_store_get_sort_column_id (GtkTreeSortable *sortable, static gboolean gtk_list_store_get_sort_column_id (GtkTreeSortable *sortable,
gint *sort_column_id, gint *sort_column_id,
GtkTreeSortOrder *order); GtkTreeSortOrder *order);
static void gtk_list_store_set_sort_column_id (GtkTreeSortable *sortable, static void gtk_list_store_set_sort_column_id (GtkTreeSortable *sortable,
gint sort_column_id, gint sort_column_id,
GtkTreeSortOrder order); GtkTreeSortOrder order);
static void gtk_list_store_sort_column_id_set_func (GtkTreeSortable *sortable, static void gtk_list_store_set_sort_func (GtkTreeSortable *sortable,
gint sort_column_id, gint sort_column_id,
GtkTreeIterCompareFunc func, GtkTreeIterCompareFunc func,
gpointer data, gpointer data,
GtkDestroyNotify destroy); GtkDestroyNotify destroy);
static void static void
...@@ -219,7 +219,7 @@ gtk_list_store_sortable_init (GtkTreeSortableIface *iface) ...@@ -219,7 +219,7 @@ gtk_list_store_sortable_init (GtkTreeSortableIface *iface)
{ {
iface->get_sort_column_id = gtk_list_store_get_sort_column_id; iface->get_sort_column_id = gtk_list_store_get_sort_column_id;
iface->set_sort_column_id = gtk_list_store_set_sort_column_id; iface->set_sort_column_id = gtk_list_store_set_sort_column_id;
iface->sort_column_id_set_func = gtk_list_store_sort_column_id_set_func; iface->set_sort_func = gtk_list_store_set_sort_func;
} }
static void static void
...@@ -589,8 +589,8 @@ gtk_list_store_set_value (GtkListStore *list_store, ...@@ -589,8 +589,8 @@ gtk_list_store_set_value (GtkListStore *list_store,
GtkTreePath *path; GtkTreePath *path;
GValue real_value = {0, }; GValue real_value = {0, };
gboolean converted = FALSE; gboolean converted = FALSE;
gint orig_column = column;
g_return_if_fail (list_store != NULL);
g_return_if_fail (GTK_IS_LIST_STORE (list_store)); g_return_if_fail (GTK_IS_LIST_STORE (list_store));
g_return_if_fail (iter != NULL); g_return_if_fail (iter != NULL);
g_return_if_fail (column >= 0 && column < list_store->n_columns); g_return_if_fail (column >= 0 && column < list_store->n_columns);
...@@ -672,7 +672,7 @@ gtk_list_store_set_value (GtkListStore *list_store, ...@@ -672,7 +672,7 @@ gtk_list_store_set_value (GtkListStore *list_store,
g_value_unset (&real_value); g_value_unset (&real_value);
if (GTK_LIST_STORE_IS_SORTED (list_store)) if (GTK_LIST_STORE_IS_SORTED (list_store))
gtk_list_store_sort_iter_changed (list_store, iter, column); gtk_list_store_sort_iter_changed (list_store, iter, orig_column);
} }
/** /**
...@@ -1681,11 +1681,11 @@ gtk_list_store_set_sort_column_id (GtkTreeSortable *sortable, ...@@ -1681,11 +1681,11 @@ gtk_list_store_set_sort_column_id (GtkTreeSortable *sortable,
} }
static void static void
gtk_list_store_sort_column_id_set_func (GtkTreeSortable *sortable, gtk_list_store_set_sort_func (GtkTreeSortable *sortable,
gint sort_column_id, gint sort_column_id,
GtkTreeIterCompareFunc func, GtkTreeIterCompareFunc func,
gpointer data, gpointer data,
GtkDestroyNotify destroy) GtkDestroyNotify destroy)
{ {
GtkListStore *list_store = (GtkListStore *) sortable; GtkListStore *list_store = (GtkListStore *) sortable;
GtkTreeDataSortHeader *header = NULL; GtkTreeDataSortHeader *header = NULL;
......
...@@ -815,6 +815,8 @@ _gtk_rbtree_reorder (GtkRBTree *tree, ...@@ -815,6 +815,8 @@ _gtk_rbtree_reorder (GtkRBTree *tree,
{ {
reorder = g_array_index (array, GtkRBReorder, i); reorder = g_array_index (array, GtkRBReorder, i);
node->children = reorder.children; node->children = reorder.children;
if (node->children)
node->children->parent_node = node;
node->flags = GTK_RBNODE_GET_COLOR (node) | reorder.flags; node->flags = GTK_RBNODE_GET_COLOR (node) | reorder.flags;
/* We temporarily set the height to this. */ /* We temporarily set the height to this. */
node->offset = reorder.height; node->offset = reorder.height;
......
...@@ -1066,6 +1066,7 @@ gtk_tree_model_range_changed (GtkTreeModel *tree_model, ...@@ -1066,6 +1066,7 @@ gtk_tree_model_range_changed (GtkTreeModel *tree_model,
GtkTreePath *end_path, GtkTreePath *end_path,
GtkTreeIter *end_iter) GtkTreeIter *end_iter)
{ {
gint i;
g_return_if_fail (tree_model != NULL); g_return_if_fail (tree_model != NULL);
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model)); g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
g_return_if_fail (start_path != NULL); g_return_if_fail (start_path != NULL);
...@@ -1073,6 +1074,15 @@ gtk_tree_model_range_changed (GtkTreeModel *tree_model, ...@@ -1073,6 +1074,15 @@ gtk_tree_model_range_changed (GtkTreeModel *tree_model,
g_return_if_fail (end_path != NULL); g_return_if_fail (end_path != NULL);
g_return_if_fail (end_iter != NULL); g_return_if_fail (end_iter != NULL);
#ifndef G_DISABLE_CHECKS
g_return_if_fail (start_path->depth == end_path->depth);
for (i = 0; i < start_path->depth - 1; i++)
if (start_path->indices[i] != end_path->indices[i])
{
g_warning ("Concurrent paths were not passed in to gtk_tree_model_range_changed.\n");
return;
}
#endif
g_signal_emit_by_name (tree_model, "range_changed", g_signal_emit_by_name (tree_model, "range_changed",
start_path, start_iter, start_path, start_iter,
end_path, end_iter); end_path, end_iter);
......
...@@ -110,17 +110,17 @@ static void gtk_tree_model_sort_unref_node (GtkTreeModel * ...@@ -110,17 +110,17 @@ static void gtk_tree_model_sort_unref_node (GtkTreeModel *
GtkTreeIter *iter); GtkTreeIter *iter);
/* sortable */ /* sortable */
static gboolean gtk_tree_model_sort_get_sort_column_id (GtkTreeSortable *sortable, static gboolean gtk_tree_model_sort_get_sort_column_id (GtkTreeSortable *sortable,
gint *sort_column_id, gint *sort_column_id,
GtkTreeSortOrder *order); GtkTreeSortOrder *order);
static void gtk_tree_model_sort_set_sort_column_id (GtkTreeSortable *sortable, static void gtk_tree_model_sort_set_sort_column_id (GtkTreeSortable *sortable,
gint sort_column_id, gint sort_column_id,
GtkTreeSortOrder order); GtkTreeSortOrder order);
static void gtk_tree_model_sort_sort_column_id_set_func (GtkTreeSortable *sortable, static void gtk_tree_model_sort_set_sort_func (GtkTreeSortable *sortable,
gint sort_column_id, gint sort_column_id,
GtkTreeIterCompareFunc func, GtkTreeIterCompareFunc func,
gpointer data, gpointer data,
GtkDestroyNotify destroy); GtkDestroyNotify destroy);
/* Internal functions */ /* Internal functions */
static gint gtk_tree_model_sort_array_find_insert (GtkTreeModelSort *tree_model_sort, static gint gtk_tree_model_sort_array_find_insert (GtkTreeModelSort *tree_model_sort,
...@@ -216,7 +216,7 @@ gtk_tree_model_sort_tree_sortable_init (GtkTreeSortableIface *iface) ...@@ -216,7 +216,7 @@ gtk_tree_model_sort_tree_sortable_init (GtkTreeSortableIface *iface)
{ {
iface->get_sort_column_id = gtk_tree_model_sort_get_sort_column_id; iface->get_sort_column_id = gtk_tree_model_sort_get_sort_column_id;
iface->set_sort_column_id = gtk_tree_model_sort_set_sort_column_id; iface->set_sort_column_id = gtk_tree_model_sort_set_sort_column_id;
iface->sort_column_id_set_func = gtk_tree_model_sort_sort_column_id_set_func; iface->set_sort_func = gtk_tree_model_sort_set_sort_func;
} }
static void static void
...@@ -939,8 +939,8 @@ gtk_tree_model_sort_get_sort_column_id (GtkTreeSortable *sortable, ...@@ -939,8 +939,8 @@ gtk_tree_model_sort_get_sort_column_id (GtkTreeSortable *sortable,
static void static void
gtk_tree_model_sort_set_sort_column_id (GtkTreeSortable *sortable, gtk_tree_model_sort_set_sort_column_id (GtkTreeSortable *sortable,
gint sort_column_id, gint sort_column_id,
GtkTreeSortOrder order) GtkTreeSortOrder order)
{ {
GtkTreeModelSort *tree_model_sort = (GtkTreeModelSort *) sortable; GtkTreeModelSort *tree_model_sort = (GtkTreeModelSort *) sortable;
GList *list; GList *list;
...@@ -971,11 +971,11 @@ gtk_tree_model_sort_set_sort_column_id (GtkTreeSortable *sortable, ...@@ -971,11 +971,11 @@ gtk_tree_model_sort_set_sort_column_id (GtkTreeSortable *sortable,
} }
static void static void
gtk_tree_model_sort_sort_column_id_set_func (GtkTreeSortable *sortable, gtk_tree_model_sort_set_sort_func (GtkTreeSortable *sortable,
gint sort_column_id, gint sort_column_id,
GtkTreeIterCompareFunc func, GtkTreeIterCompareFunc func,
gpointer data, gpointer data,
GtkDestroyNotify destroy) GtkDestroyNotify destroy)
{ {
GtkTreeModelSort *tree_model_sort = (GtkTreeModelSort *) sortable; GtkTreeModelSort *tree_model_sort = (GtkTreeModelSort *) sortable;
GtkTreeDataSortHeader *header = NULL; GtkTreeDataSortHeader *header = NULL;
......
...@@ -114,11 +114,11 @@ gtk_tree_sortable_set_sort_column_id (GtkTreeSortable *sortable, ...@@ -114,11 +114,11 @@ gtk_tree_sortable_set_sort_column_id (GtkTreeSortable *sortable,
} }
void void
gtk_tree_sortable_sort_column_id_set_func (GtkTreeSortable *sortable, gtk_tree_sortable_set_sort_func (GtkTreeSortable *sortable,
gint sort_column_id, gint sort_column_id,
GtkTreeIterCompareFunc func, GtkTreeIterCompareFunc func,
gpointer data, gpointer data,
GtkDestroyNotify destroy) GtkDestroyNotify destroy)
{ {
GtkTreeSortableIface *iface; GtkTreeSortableIface *iface;
...@@ -128,9 +128,9 @@ gtk_tree_sortable_sort_column_id_set_func (GtkTreeSortable *sortable, ...@@ -128,9 +128,9 @@ gtk_tree_sortable_sort_column_id_set_func (GtkTreeSortable *sortable,
iface = GTK_TREE_SORTABLE_GET_IFACE (sortable); iface = GTK_TREE_SORTABLE_GET_IFACE (sortable);
g_return_if_fail (iface != NULL); g_return_if_fail (iface != NULL);
g_return_if_fail (iface->sort_column_id_set_func != NULL); g_return_if_fail (iface->set_sort_func != NULL);
(* iface->sort_column_id_set_func) (sortable, sort_column_id, func, data, destroy); (* iface->set_sort_func) (sortable, sort_column_id, func, data, destroy);
} }
...@@ -56,35 +56,34 @@ struct _GtkTreeSortableIface ...@@ -56,35 +56,34 @@ struct _GtkTreeSortableIface
void (* sort_column_changed) (GtkTreeSortable *sortable); void (* sort_column_changed) (GtkTreeSortable *sortable);
/* virtual table */ /* virtual table */
gboolean (* get_sort_column_id) (GtkTreeSortable *sortable, gboolean (* get_sort_column_id) (GtkTreeSortable *sortable,
gint *sort_column_id, gint *sort_column_id,
GtkTreeSortOrder *order); GtkTreeSortOrder *order);
void (* set_sort_column_id) (GtkTreeSortable *sortable, void (* set_sort_column_id) (GtkTreeSortable *sortable,
gint sort_column_id, gint sort_column_id,
GtkTreeSortOrder order); GtkTreeSortOrder order);
void (* sort_column_id_set_func) (GtkTreeSortable *sortable, void (* set_sort_func) (GtkTreeSortable *sortable,
gint sort_column_id, gint sort_column_id,
GtkTreeIterCompareFunc func, GtkTreeIterCompareFunc func,
gpointer data, gpointer data,
GtkDestroyNotify destroy); GtkDestroyNotify destroy);
}; };
GType gtk_tree_sortable_get_type (void) G_GNUC_CONST; GType gtk_tree_sortable_get_type (void) G_GNUC_CONST;
void gtk_tree_sortable_sort_column_changed (GtkTreeSortable *sortable); void gtk_tree_sortable_sort_column_changed (GtkTreeSortable *sortable);
gboolean gtk_tree_sortable_get_sort_column_id (GtkTreeSortable *sortable, gboolean gtk_tree_sortable_get_sort_column_id (GtkTreeSortable *sortable,
gint *sort_column_id, gint *sort_column_id,
GtkTreeSortOrder *order); GtkTreeSortOrder *order);
void gtk_tree_sortable_set_sort_column_id (GtkTreeSortable *sortable, void gtk_tree_sortable_set_sort_column_id (GtkTreeSortable *sortable,
gint sort_column_id, gint sort_column_id,
GtkTreeSortOrder order); GtkTreeSortOrder order);
void gtk_tree_sortable_sort_column_id_set_func (GtkTreeSortable *sortable, void gtk_tree_sortable_set_sort_func (GtkTreeSortable *sortable,
gint sort_column_id, gint sort_column_id,
GtkTreeIterCompareFunc func, GtkTreeIterCompareFunc func,
gpointer data, gpointer data,
GtkDestroyNotify destroy); GtkDestroyNotify destroy);
......
/* gtktreestore.c /* gtktreestore.c
* Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <jrb@redhat.com> * Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <jrb@redhat.com>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
...@@ -87,7 +87,7 @@ static gboolean gtk_tree_store_get_sort_column_id (GtkTreeSortable * ...@@ -87,7 +87,7 @@ static gboolean gtk_tree_store_get_sort_column_id (GtkTreeSortable *
static void gtk_tree_store_set_sort_column_id (GtkTreeSortable *sortable, static void gtk_tree_store_set_sort_column_id (GtkTreeSortable *sortable,
gint sort_column_id, gint sort_column_id,
GtkTreeSortOrder order); GtkTreeSortOrder order);
static void gtk_tree_store_sort_column_id_set_func (GtkTreeSortable *sortable, static void gtk_tree_store_set_sort_func (GtkTreeSortable *sortable,
gint sort_column_id, gint sort_column_id,
GtkTreeIterCompareFunc func, GtkTreeIterCompareFunc func,
gpointer data, gpointer data,
...@@ -219,7 +219,7 @@ gtk_tree_store_sortable_init (GtkTreeSortableIface *iface) ...@@ -219,7 +219,7 @@ gtk_tree_store_sortable_init (GtkTreeSortableIface *iface)
{ {
iface->get_sort_column_id = gtk_tree_store_get_sort_column_id; iface->get_sort_column_id = gtk_tree_store_get_sort_column_id;
iface->set_sort_column_id = gtk_tree_store_set_sort_column_id; iface->set_sort_column_id = gtk_tree_store_set_sort_column_id;
iface->sort_column_id_set_func = gtk_tree_store_sort_column_id_set_func; iface->set_sort_func = gtk_tree_store_set_sort_func;
} }
static void static void
...@@ -270,9 +270,9 @@ gtk_tree_store_new_with_types (gint n_columns, ...@@ -270,9 +270,9 @@ gtk_tree_store_new_with_types (gint n_columns,
/** /**
* gtk_tree_store_set_n_columns: * gtk_tree_store_set_n_columns:
* @tree_store: * @tree_store:
* @n_columns: * @n_columns:
* *
* As a side effect of calling this function, all sort columns that overlap with * As a side effect of calling this function, all sort columns that overlap with
* the current number of columns will be removed. * the current number of columns will be removed.
**/ **/
...@@ -383,9 +383,13 @@ gtk_tree_store_get_path (GtkTreeModel *tree_model, ...@@ -383,9 +383,13 @@ gtk_tree_store_get_path (GtkTreeModel *tree_model,
g_return_val_if_fail (GTK_IS_TREE_STORE (tree_model), NULL); g_return_val_if_fail (GTK_IS_TREE_STORE (tree_model), NULL);
g_return_val_if_fail (iter != NULL, NULL); g_return_val_if_fail (iter != NULL, NULL);
g_return_val_if_fail (iter->user_data != NULL, NULL); g_return_val_if_fail (iter->user_data != NULL, NULL);
g_return_val_if_fail (iter->stamp == GTK_TREE_STORE (tree_model)->stamp, NULL);
validate_tree ((GtkTreeStore*)tree_model); validate_tree ((GtkTreeStore*)tree_model);
if (G_NODE (iter->user_data)->parent == NULL &&
G_NODE (iter->user_data) == GTK_TREE_STORE (tree_model)->root)
return gtk_tree_path_new ();
g_assert (G_NODE (iter->user_data)->parent != NULL); g_assert (G_NODE (iter->user_data)->parent != NULL);
if (G_NODE (iter->user_data)->parent == G_NODE (GTK_TREE_STORE (tree_model)->root)) if (G_NODE (iter->user_data)->parent == G_NODE (GTK_TREE_STORE (tree_model)->root))
...@@ -612,9 +616,11 @@ gtk_tree_store_set_value (GtkTreeStore *tree_store, ...@@ -612,9 +616,11 @@ gtk_tree_store_set_value (GtkTreeStore *tree_store,
GtkTreePath *path = NULL; GtkTreePath *path = NULL;
GValue real_value = {0, }; GValue real_value = {0, };
gboolean converted = FALSE; gboolean converted = FALSE;
gint orig_column = column;
g_return_if_fail (tree_store != NULL);
g_return_if_fail (GTK_IS_TREE_STORE (tree_store)); g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
g_return_if_fail (iter != NULL);
g_return_if_fail (GTK_TREE_STORE (tree_store)->stamp == iter->stamp);
g_return_if_fail (column >= 0 && column < tree_store->n_columns); g_return_if_fail (column >= 0 && column < tree_store->n_columns);
g_return_if_fail (G_IS_VALUE (value)); g_return_if_fail (G_IS_VALUE (value));
...@@ -693,7 +699,7 @@ gtk_tree_store_set_value (GtkTreeStore *tree_store, ...@@ -693,7 +699,7 @@ gtk_tree_store_set_value (GtkTreeStore *tree_store,
g_value_unset (&real_value); g_value_unset (&real_value);
if (GTK_TREE_STORE_IS_SORTED (tree_store)) if (GTK_TREE_STORE_IS_SORTED (tree_store))
gtk_tree_store_sort_iter_changed (tree_store, iter, column); gtk_tree_store_sort_iter_changed (tree_store, iter, orig_column);
} }
/** /**
...@@ -1380,17 +1386,20 @@ gtk_tree_store_compare_func (gconstpointer a, ...@@ -1380,17 +1386,20 @@ gtk_tree_store_compare_func (gconstpointer a,
static void static void
gtk_tree_store_sort_helper (GtkTreeStore *tree_store, gtk_tree_store_sort_helper (GtkTreeStore *tree_store,
GNode *node) GNode *parent,
gboolean recurse)
{ {
GtkTreeDataSortHeader *header = NULL; GtkTreeDataSortHeader *header = NULL;
GtkTreeIter iter; GtkTreeIter iter;
GArray *sort_array; GArray *sort_array;
GNode *node;
GNode *tmp_node; GNode *tmp_node;
gint list_length; gint list_length;
gint i; gint i;
gint *new_order; gint *new_order;
GtkTreePath *path; GtkTreePath *path;
node = parent->children;
if (node->next == NULL) if (node->next == NULL)
return; return;
...@@ -1430,27 +1439,36 @@ gtk_tree_store_sort_helper (GtkTreeStore *tree_store, ...@@ -1430,27 +1439,36 @@ gtk_tree_store_sort_helper (GtkTreeStore *tree_store,
} }
g_array_index (sort_array, SortTuple, list_length - 1).node->next = NULL; g_array_index (sort_array, SortTuple, list_length - 1).node->next = NULL;
g_array_index (sort_array, SortTuple, 0).node->prev = NULL; g_array_index (sort_array, SortTuple, 0).node->prev = NULL;
G_NODE (tree_store->root)->children = g_array_index (sort_array, SortTuple, 0).node; parent->children = g_array_index (sort_array, SortTuple, 0).node;
/* Let the world know about our new order */ /* Let the world know about our new order */
new_order = g_new (gint, list_length); new_order = g_new (gint, list_length);
for (i = 0; i < list_length; i++) for (i = 0; i < list_length; i++)
new_order[i] = g_array_index (sort_array, SortTuple, i).offset; new_order[i] = g_array_index (sort_array, SortTuple, i).offset;
path = gtk_tree_path_new ();
iter.stamp = tree_store->stamp;
iter.user_data = NULL;
iter.stamp = tree_store->stamp;
iter.user_data = parent;
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), &iter);
gtk_tree_model_reordered (GTK_TREE_MODEL (tree_store), gtk_tree_model_reordered (GTK_TREE_MODEL (tree_store),
path, &iter, new_order); path, &iter, new_order);
gtk_tree_path_free (path); gtk_tree_path_free (path);
g_free (new_order); g_free (new_order);
g_array_free (sort_array, TRUE); g_array_free (sort_array, TRUE);
if (recurse)
{
for (tmp_node = parent->children; tmp_node; tmp_node = tmp_node->next)
{
if (tmp_node->children)
gtk_tree_store_sort_helper (tree_store, tmp_node, TRUE);
}
}
} }
static void static void
gtk_tree_store_sort (GtkTreeStore *tree_store) gtk_tree_store_sort (GtkTreeStore *tree_store)
{ {
gtk_tree_store_sort_helper (tree_store, G_NODE (tree_store->root)->children); gtk_tree_store_sort_helper (tree_store, G_NODE (tree_store->root), TRUE);
} }
static void static void
...@@ -1472,11 +1490,8 @@ gtk_tree_store_sort_iter_changed (GtkTreeStore *tree_store, ...@@ -1472,11 +1490,8 @@ gtk_tree_store_sort_iter_changed (GtkTreeStore *tree_store,
gint *new_order; gint *new_order;
gint length; gint length;
/* FIX*/ g_return_if_fail (G_NODE (iter->user_data)->parent != NULL);
if (G_NODE (iter->user_data)->parent)
node = G_NODE (iter->user_data)->parent->children;
else
node = G_NODE (tree_store->root);
tmp_iter.stamp = tree_store->stamp; tmp_iter.stamp = tree_store->stamp;