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.
This commit is contained in:
Matthias Clasen 2004-09-05 05:06:05 +00:00 committed by Matthias Clasen
parent 44bfacfc5f
commit 71e3cae54c
7 changed files with 83 additions and 26 deletions

View File

@ -1,3 +1,15 @@
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.
Sat Sep 4 23:37:56 2004 Matthias Clasen <maclas@gmx.de>
* configure.in: Fix the Solaris Xinerama checks. (#151754)

View File

@ -1,3 +1,15 @@
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.
Sat Sep 4 23:37:56 2004 Matthias Clasen <maclas@gmx.de>
* configure.in: Fix the Solaris Xinerama checks. (#151754)

View File

@ -1,3 +1,15 @@
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.
Sat Sep 4 23:37:56 2004 Matthias Clasen <maclas@gmx.de>
* configure.in: Fix the Solaris Xinerama checks. (#151754)

View File

@ -1,3 +1,15 @@
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.
Sat Sep 4 23:37:56 2004 Matthias Clasen <maclas@gmx.de>
* configure.in: Fix the Solaris Xinerama checks. (#151754)

View File

@ -27,7 +27,7 @@
#include "gtktreednd.h"
#include "gtksequence.h"
#define GTK_LIST_STORE_IS_SORTED(list) (GTK_LIST_STORE (list)->sort_column_id != -2)
#define GTK_LIST_STORE_IS_SORTED(list) (GTK_LIST_STORE (list)->sort_column_id != GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID)
#define VALID_ITER(iter, list_store) ((iter)!= NULL && (iter)->user_data != NULL && list_store->stamp == (iter)->stamp && !_gtk_sequence_ptr_is_end ((iter)->user_data) && _gtk_sequence_ptr_get_sequence ((iter)->user_data) == list_store->seq)
static void gtk_list_store_init (GtkListStore *list_store);
@ -1650,7 +1650,8 @@ gtk_list_store_sort (GtkListStore *list_store)
GtkTreePath *path;
GHashTable *old_positions;
if (_gtk_sequence_get_length (list_store->seq) <= 1)
if (!GTK_LIST_STORE_IS_SORTED (list_store) ||
_gtk_sequence_get_length (list_store->seq) <= 1)
return;
old_positions = save_positions (list_store->seq);
@ -1716,19 +1717,22 @@ gtk_list_store_set_sort_column_id (GtkTreeSortable *sortable,
(list_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 (list_store->sort_list, sort_column_id);
header = _gtk_tree_data_list_get_header (list_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 (list_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 (list_store->default_sort_func != NULL);
}
}

View File

@ -33,7 +33,8 @@ G_BEGIN_DECLS
#define GTK_TREE_SORTABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_TREE_SORTABLE, GtkTreeSortableIface))
enum {
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID = -1
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID = -1,
GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID = -2
};
typedef struct _GtkTreeSortable GtkTreeSortable; /* Dummy typedef */

View File

@ -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;