mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
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!!!!!
This commit is contained in:
parent
6adcae811b
commit
67f8b5bd46
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
||||
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 Borgström <jonas@codefactory.se>
|
||||
|
||||
* gtk/gtkwindow.h: Fixed a small typo, it should be
|
||||
|
@ -1,3 +1,17 @@
|
||||
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 Borgström <jonas@codefactory.se>
|
||||
|
||||
* gtk/gtkwindow.h: Fixed a small typo, it should be
|
||||
|
@ -1,3 +1,17 @@
|
||||
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 Borgström <jonas@codefactory.se>
|
||||
|
||||
* gtk/gtkwindow.h: Fixed a small typo, it should be
|
||||
|
@ -1,3 +1,17 @@
|
||||
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 Borgström <jonas@codefactory.se>
|
||||
|
||||
* gtk/gtkwindow.h: Fixed a small typo, it should be
|
||||
|
@ -1,3 +1,17 @@
|
||||
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 Borgström <jonas@codefactory.se>
|
||||
|
||||
* gtk/gtkwindow.h: Fixed a small typo, it should be
|
||||
|
@ -1,3 +1,17 @@
|
||||
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 Borgström <jonas@codefactory.se>
|
||||
|
||||
* gtk/gtkwindow.h: Fixed a small typo, it should be
|
||||
|
@ -1,3 +1,17 @@
|
||||
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 Borgström <jonas@codefactory.se>
|
||||
|
||||
* 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,
|
||||
|
||||
|
||||
/* sortable */
|
||||
static void gtk_list_store_sort (GtkListStore *list_store);
|
||||
static void gtk_list_store_sort_iter_changed (GtkListStore *list_store,
|
||||
GtkTreeIter *iter,
|
||||
gint column);
|
||||
static gboolean gtk_list_store_get_sort_column_id (GtkTreeSortable *sortable,
|
||||
gint *sort_column_id,
|
||||
GtkTreeSortOrder *order);
|
||||
static void gtk_list_store_set_sort_column_id (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeSortOrder order);
|
||||
static void gtk_list_store_sort_column_id_set_func (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeIterCompareFunc func,
|
||||
gpointer data,
|
||||
GtkDestroyNotify destroy);
|
||||
static void gtk_list_store_sort (GtkListStore *list_store);
|
||||
static void gtk_list_store_sort_iter_changed (GtkListStore *list_store,
|
||||
GtkTreeIter *iter,
|
||||
gint column);
|
||||
static gboolean gtk_list_store_get_sort_column_id (GtkTreeSortable *sortable,
|
||||
gint *sort_column_id,
|
||||
GtkTreeSortOrder *order);
|
||||
static void gtk_list_store_set_sort_column_id (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeSortOrder order);
|
||||
static void gtk_list_store_set_sort_func (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeIterCompareFunc func,
|
||||
gpointer data,
|
||||
GtkDestroyNotify destroy);
|
||||
|
||||
|
||||
static void
|
||||
@ -219,7 +219,7 @@ gtk_list_store_sortable_init (GtkTreeSortableIface *iface)
|
||||
{
|
||||
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->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
|
||||
@ -589,8 +589,8 @@ gtk_list_store_set_value (GtkListStore *list_store,
|
||||
GtkTreePath *path;
|
||||
GValue real_value = {0, };
|
||||
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 (iter != NULL);
|
||||
g_return_if_fail (column >= 0 && column < list_store->n_columns);
|
||||
@ -672,7 +672,7 @@ gtk_list_store_set_value (GtkListStore *list_store,
|
||||
g_value_unset (&real_value);
|
||||
|
||||
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,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_list_store_sort_column_id_set_func (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeIterCompareFunc func,
|
||||
gpointer data,
|
||||
GtkDestroyNotify destroy)
|
||||
gtk_list_store_set_sort_func (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeIterCompareFunc func,
|
||||
gpointer data,
|
||||
GtkDestroyNotify destroy)
|
||||
{
|
||||
GtkListStore *list_store = (GtkListStore *) sortable;
|
||||
GtkTreeDataSortHeader *header = NULL;
|
||||
|
@ -815,6 +815,8 @@ _gtk_rbtree_reorder (GtkRBTree *tree,
|
||||
{
|
||||
reorder = g_array_index (array, GtkRBReorder, i);
|
||||
node->children = reorder.children;
|
||||
if (node->children)
|
||||
node->children->parent_node = node;
|
||||
node->flags = GTK_RBNODE_GET_COLOR (node) | reorder.flags;
|
||||
/* We temporarily set the height to this. */
|
||||
node->offset = reorder.height;
|
||||
|
@ -1066,6 +1066,7 @@ gtk_tree_model_range_changed (GtkTreeModel *tree_model,
|
||||
GtkTreePath *end_path,
|
||||
GtkTreeIter *end_iter)
|
||||
{
|
||||
gint i;
|
||||
g_return_if_fail (tree_model != NULL);
|
||||
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
|
||||
g_return_if_fail (start_path != NULL);
|
||||
@ -1073,6 +1074,15 @@ gtk_tree_model_range_changed (GtkTreeModel *tree_model,
|
||||
g_return_if_fail (end_path != 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",
|
||||
start_path, start_iter,
|
||||
end_path, end_iter);
|
||||
|
@ -110,17 +110,17 @@ static void gtk_tree_model_sort_unref_node (GtkTreeModel *
|
||||
GtkTreeIter *iter);
|
||||
|
||||
/* sortable */
|
||||
static gboolean gtk_tree_model_sort_get_sort_column_id (GtkTreeSortable *sortable,
|
||||
gint *sort_column_id,
|
||||
GtkTreeSortOrder *order);
|
||||
static void gtk_tree_model_sort_set_sort_column_id (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeSortOrder order);
|
||||
static void gtk_tree_model_sort_sort_column_id_set_func (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeIterCompareFunc func,
|
||||
gpointer data,
|
||||
GtkDestroyNotify destroy);
|
||||
static gboolean gtk_tree_model_sort_get_sort_column_id (GtkTreeSortable *sortable,
|
||||
gint *sort_column_id,
|
||||
GtkTreeSortOrder *order);
|
||||
static void gtk_tree_model_sort_set_sort_column_id (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeSortOrder order);
|
||||
static void gtk_tree_model_sort_set_sort_func (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeIterCompareFunc func,
|
||||
gpointer data,
|
||||
GtkDestroyNotify destroy);
|
||||
|
||||
/* Internal functions */
|
||||
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)
|
||||
{
|
||||
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->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
|
||||
@ -939,8 +939,8 @@ gtk_tree_model_sort_get_sort_column_id (GtkTreeSortable *sortable,
|
||||
|
||||
static void
|
||||
gtk_tree_model_sort_set_sort_column_id (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeSortOrder order)
|
||||
gint sort_column_id,
|
||||
GtkTreeSortOrder order)
|
||||
{
|
||||
GtkTreeModelSort *tree_model_sort = (GtkTreeModelSort *) sortable;
|
||||
GList *list;
|
||||
@ -971,11 +971,11 @@ gtk_tree_model_sort_set_sort_column_id (GtkTreeSortable *sortable,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_model_sort_sort_column_id_set_func (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeIterCompareFunc func,
|
||||
gpointer data,
|
||||
GtkDestroyNotify destroy)
|
||||
gtk_tree_model_sort_set_sort_func (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeIterCompareFunc func,
|
||||
gpointer data,
|
||||
GtkDestroyNotify destroy)
|
||||
{
|
||||
GtkTreeModelSort *tree_model_sort = (GtkTreeModelSort *) sortable;
|
||||
GtkTreeDataSortHeader *header = NULL;
|
||||
|
@ -114,11 +114,11 @@ gtk_tree_sortable_set_sort_column_id (GtkTreeSortable *sortable,
|
||||
}
|
||||
|
||||
void
|
||||
gtk_tree_sortable_sort_column_id_set_func (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeIterCompareFunc func,
|
||||
gpointer data,
|
||||
GtkDestroyNotify destroy)
|
||||
gtk_tree_sortable_set_sort_func (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeIterCompareFunc func,
|
||||
gpointer data,
|
||||
GtkDestroyNotify destroy)
|
||||
{
|
||||
GtkTreeSortableIface *iface;
|
||||
|
||||
@ -128,9 +128,9 @@ gtk_tree_sortable_sort_column_id_set_func (GtkTreeSortable *sortable,
|
||||
iface = GTK_TREE_SORTABLE_GET_IFACE (sortable);
|
||||
|
||||
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
|
||||
void (* sort_column_changed) (GtkTreeSortable *sortable);
|
||||
|
||||
/* virtual table */
|
||||
gboolean (* get_sort_column_id) (GtkTreeSortable *sortable,
|
||||
gint *sort_column_id,
|
||||
GtkTreeSortOrder *order);
|
||||
void (* set_sort_column_id) (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeSortOrder order);
|
||||
void (* sort_column_id_set_func) (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeIterCompareFunc func,
|
||||
gpointer data,
|
||||
GtkDestroyNotify destroy);
|
||||
gboolean (* get_sort_column_id) (GtkTreeSortable *sortable,
|
||||
gint *sort_column_id,
|
||||
GtkTreeSortOrder *order);
|
||||
void (* set_sort_column_id) (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeSortOrder order);
|
||||
void (* set_sort_func) (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeIterCompareFunc func,
|
||||
gpointer data,
|
||||
GtkDestroyNotify destroy);
|
||||
};
|
||||
|
||||
|
||||
GType gtk_tree_sortable_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void gtk_tree_sortable_sort_column_changed (GtkTreeSortable *sortable);
|
||||
gboolean gtk_tree_sortable_get_sort_column_id (GtkTreeSortable *sortable,
|
||||
gint *sort_column_id,
|
||||
GtkTreeSortOrder *order);
|
||||
void gtk_tree_sortable_set_sort_column_id (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeSortOrder order);
|
||||
void gtk_tree_sortable_sort_column_id_set_func (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeIterCompareFunc func,
|
||||
gpointer data,
|
||||
GtkDestroyNotify destroy);
|
||||
|
||||
void gtk_tree_sortable_sort_column_changed (GtkTreeSortable *sortable);
|
||||
gboolean gtk_tree_sortable_get_sort_column_id (GtkTreeSortable *sortable,
|
||||
gint *sort_column_id,
|
||||
GtkTreeSortOrder *order);
|
||||
void gtk_tree_sortable_set_sort_column_id (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeSortOrder order);
|
||||
void gtk_tree_sortable_set_sort_func (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeIterCompareFunc func,
|
||||
gpointer data,
|
||||
GtkDestroyNotify destroy);
|
||||
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* 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
|
||||
* 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 *
|
||||
static void gtk_tree_store_set_sort_column_id (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
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,
|
||||
GtkTreeIterCompareFunc func,
|
||||
gpointer data,
|
||||
@ -219,7 +219,7 @@ gtk_tree_store_sortable_init (GtkTreeSortableIface *iface)
|
||||
{
|
||||
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->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
|
||||
@ -270,9 +270,9 @@ gtk_tree_store_new_with_types (gint n_columns,
|
||||
|
||||
/**
|
||||
* gtk_tree_store_set_n_columns:
|
||||
* @tree_store:
|
||||
* @n_columns:
|
||||
*
|
||||
* @tree_store:
|
||||
* @n_columns:
|
||||
*
|
||||
* As a side effect of calling this function, all sort columns that overlap with
|
||||
* the current number of columns will be removed.
|
||||
**/
|
||||
@ -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 (iter != 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);
|
||||
|
||||
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);
|
||||
|
||||
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,
|
||||
GtkTreePath *path = NULL;
|
||||
GValue real_value = {0, };
|
||||
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 (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 (G_IS_VALUE (value));
|
||||
|
||||
@ -693,7 +699,7 @@ gtk_tree_store_set_value (GtkTreeStore *tree_store,
|
||||
g_value_unset (&real_value);
|
||||
|
||||
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,
|
||||
|
||||
static void
|
||||
gtk_tree_store_sort_helper (GtkTreeStore *tree_store,
|
||||
GNode *node)
|
||||
GNode *parent,
|
||||
gboolean recurse)
|
||||
{
|
||||
GtkTreeDataSortHeader *header = NULL;
|
||||
GtkTreeIter iter;
|
||||
GArray *sort_array;
|
||||
GNode *node;
|
||||
GNode *tmp_node;
|
||||
gint list_length;
|
||||
gint i;
|
||||
gint *new_order;
|
||||
GtkTreePath *path;
|
||||
|
||||
node = parent->children;
|
||||
if (node->next == NULL)
|
||||
return;
|
||||
|
||||
@ -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, 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 */
|
||||
new_order = g_new (gint, list_length);
|
||||
for (i = 0; i < list_length; i++)
|
||||
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),
|
||||
path, &iter, new_order);
|
||||
gtk_tree_path_free (path);
|
||||
g_free (new_order);
|
||||
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
|
||||
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
|
||||
@ -1472,11 +1490,8 @@ gtk_tree_store_sort_iter_changed (GtkTreeStore *tree_store,
|
||||
gint *new_order;
|
||||
gint length;
|
||||
|
||||
/* FIX*/
|
||||
if (G_NODE (iter->user_data)->parent)
|
||||
node = G_NODE (iter->user_data)->parent->children;
|
||||
else
|
||||
node = G_NODE (tree_store->root);
|
||||
g_return_if_fail (G_NODE (iter->user_data)->parent != NULL);
|
||||
|
||||
|
||||
tmp_iter.stamp = tree_store->stamp;
|
||||
header = _gtk_tree_data_list_get_header (tree_store->sort_list,
|
||||
@ -1490,17 +1505,18 @@ gtk_tree_store_sort_iter_changed (GtkTreeStore *tree_store,
|
||||
return;
|
||||
|
||||
old_location = 0;
|
||||
node = G_NODE (iter->user_data)->parent->children;
|
||||
/* First we find the iter, its prev, and its next */
|
||||
while (node)
|
||||
{
|
||||
if (node == G_NODE (iter->user_data))
|
||||
break;
|
||||
prev = node;
|
||||
node = node->next;
|
||||
old_location++;
|
||||
node = node->next;
|
||||
}
|
||||
g_assert (node != NULL);
|
||||
|
||||
prev = node->prev;
|
||||
next = node->next;
|
||||
|
||||
/* Check the common case, where we don't need to sort it moved. */
|
||||
@ -1545,15 +1561,19 @@ gtk_tree_store_sort_iter_changed (GtkTreeStore *tree_store,
|
||||
/* We actually need to sort it */
|
||||
/* First, remove the old link. */
|
||||
|
||||
if (prev == NULL)
|
||||
tree_store->root = next;
|
||||
else
|
||||
if (prev)
|
||||
prev->next = next;
|
||||
else
|
||||
node->parent->children = next;
|
||||
if (next)
|
||||
next->prev = prev;
|
||||
|
||||
node->prev = NULL;
|
||||
node->next = NULL;
|
||||
|
||||
|
||||
/* FIXME: as an optimization, we can potentially start at next */
|
||||
prev = NULL;
|
||||
node = G_NODE (tree_store->root);
|
||||
node = node->parent->children;
|
||||
new_location = 0;
|
||||
tmp_iter.user_data = node;
|
||||
if (tree_store->order == GTK_TREE_SORT_DESCENDING)
|
||||
@ -1580,16 +1600,19 @@ gtk_tree_store_sort_iter_changed (GtkTreeStore *tree_store,
|
||||
if ((!node->next) && (cmp_a > 0))
|
||||
{
|
||||
node->next = G_NODE (iter->user_data);
|
||||
node->next->prev = node;
|
||||
}
|
||||
else if (prev)
|
||||
{
|
||||
prev->next = G_NODE (iter->user_data);
|
||||
prev->next->prev = prev;
|
||||
G_NODE (iter->user_data)->next = node;
|
||||
G_NODE (iter->user_data)->next->prev = G_NODE (iter->user_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
G_NODE (iter->user_data)->next = G_NODE (tree_store->root);
|
||||
tree_store->root = G_NODE (iter->user_data);
|
||||
G_NODE (iter->user_data)->next = G_NODE (iter->user_data)->parent->children;
|
||||
G_NODE (iter->user_data)->parent->children = G_NODE (iter->user_data);
|
||||
}
|
||||
|
||||
/* Emit the reordered signal. */
|
||||
@ -1620,9 +1643,8 @@ gtk_tree_store_sort_iter_changed (GtkTreeStore *tree_store,
|
||||
new_order[i] = old_location;
|
||||
}
|
||||
|
||||
|
||||
tmp_path = gtk_tree_path_new ();
|
||||
tmp_iter.user_data = NULL;
|
||||
tmp_iter.user_data = node->parent;
|
||||
tmp_path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), &tmp_iter);
|
||||
|
||||
gtk_tree_model_reordered (GTK_TREE_MODEL (tree_store),
|
||||
tmp_path, &tmp_iter,
|
||||
@ -1687,11 +1709,11 @@ gtk_tree_store_set_sort_column_id (GtkTreeSortable *sortable,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_store_sort_column_id_set_func (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeIterCompareFunc func,
|
||||
gpointer data,
|
||||
GtkDestroyNotify destroy)
|
||||
gtk_tree_store_set_sort_func (GtkTreeSortable *sortable,
|
||||
gint sort_column_id,
|
||||
GtkTreeIterCompareFunc func,
|
||||
gpointer data,
|
||||
GtkDestroyNotify destroy)
|
||||
{
|
||||
GtkTreeStore *tree_store = (GtkTreeStore *) sortable;
|
||||
GtkTreeDataSortHeader *header = NULL;
|
||||
|
@ -2500,7 +2500,7 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
|
||||
flags |= GTK_CELL_RENDERER_SELECTED;
|
||||
|
||||
parity = _gtk_rbtree_node_find_parity (tree, node);
|
||||
|
||||
|
||||
for (i = 0, list = tree_view->priv->columns; i < tree_view->priv->n_columns; i++, list = list->next)
|
||||
{
|
||||
GtkTreeViewColumn *column = list->data;
|
||||
|
@ -1,5 +1,26 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/*
|
||||
* README README README README README README README README README README
|
||||
* README README README README README README README README README README
|
||||
* README README README README README README README README README README
|
||||
* README README README README README README README README README README
|
||||
* README README README README README README README README README README
|
||||
* README README README README README README README README README README
|
||||
* README README README README README README README README README README
|
||||
* README README README README README README README README README README
|
||||
* README README README README README README README README README README
|
||||
* README README README README README README README README README README
|
||||
* README README README README README README README README README README
|
||||
* README README README README README README README README README README
|
||||
* README README README README README README README README README README
|
||||
*
|
||||
* DO NOT!!! I REPEAT DO NOT! EVER LOOK AT THIS CODE AS AN EXAMPLE OF WHAT YOUR
|
||||
* CODE SHOULD LOOK LIKE.
|
||||
*
|
||||
* IT IS VERY CONFUSING, AND IS MEANT TO TEST A LOT OF CODE IN THE TREE. WHILE
|
||||
* IT IS ACTUALLY CORRECT CODE, IT IS NOT USEFUL.
|
||||
*/
|
||||
|
||||
GtkWidget *left_tree_view;
|
||||
GtkWidget *top_right_tree_view;
|
||||
@ -14,8 +35,7 @@ GtkWidget *sample_tree_view_bottom;
|
||||
|
||||
|
||||
|
||||
/* Kids, don't try this at home.
|
||||
*/
|
||||
/* Kids, don't try this at home. */
|
||||
|
||||
/* Small GtkTreeModel to model columns */
|
||||
typedef struct _ViewColumnModel ViewColumnModel;
|
||||
|
@ -25,7 +25,7 @@ node_set (GtkTreeIter *iter)
|
||||
gtk_tree_store_set (base_model, iter, 0, str, -1);
|
||||
g_free (str);
|
||||
|
||||
n = g_random_int ();
|
||||
n = g_random_int_range (10000,99999);
|
||||
if (n < 0)
|
||||
n *= -1;
|
||||
str = g_strdup_printf ("%d", n);
|
||||
|
Loading…
Reference in New Issue
Block a user