mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-12 20:00:09 +00:00
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:
parent
44bfacfc5f
commit
71e3cae54c
12
ChangeLog
12
ChangeLog
@ -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>
|
Sat Sep 4 23:37:56 2004 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* configure.in: Fix the Solaris Xinerama checks. (#151754)
|
* configure.in: Fix the Solaris Xinerama checks. (#151754)
|
||||||
|
@ -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>
|
Sat Sep 4 23:37:56 2004 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* configure.in: Fix the Solaris Xinerama checks. (#151754)
|
* configure.in: Fix the Solaris Xinerama checks. (#151754)
|
||||||
|
@ -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>
|
Sat Sep 4 23:37:56 2004 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* configure.in: Fix the Solaris Xinerama checks. (#151754)
|
* configure.in: Fix the Solaris Xinerama checks. (#151754)
|
||||||
|
@ -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>
|
Sat Sep 4 23:37:56 2004 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* configure.in: Fix the Solaris Xinerama checks. (#151754)
|
* configure.in: Fix the Solaris Xinerama checks. (#151754)
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "gtktreednd.h"
|
#include "gtktreednd.h"
|
||||||
#include "gtksequence.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)
|
#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);
|
static void gtk_list_store_init (GtkListStore *list_store);
|
||||||
@ -1650,7 +1650,8 @@ gtk_list_store_sort (GtkListStore *list_store)
|
|||||||
GtkTreePath *path;
|
GtkTreePath *path;
|
||||||
GHashTable *old_positions;
|
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;
|
return;
|
||||||
|
|
||||||
old_positions = save_positions (list_store->seq);
|
old_positions = save_positions (list_store->seq);
|
||||||
@ -1716,19 +1717,22 @@ gtk_list_store_set_sort_column_id (GtkTreeSortable *sortable,
|
|||||||
(list_store->order == order))
|
(list_store->order == order))
|
||||||
return;
|
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 */
|
/* We want to make sure that we have a function */
|
||||||
g_return_if_fail (header != NULL);
|
g_return_if_fail (header != NULL);
|
||||||
g_return_if_fail (header->func != NULL);
|
g_return_if_fail (header->func != NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_return_if_fail (list_store->default_sort_func != NULL);
|
g_return_if_fail (list_store->default_sort_func != NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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))
|
#define GTK_TREE_SORTABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_TREE_SORTABLE, GtkTreeSortableIface))
|
||||||
|
|
||||||
enum {
|
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 */
|
typedef struct _GtkTreeSortable GtkTreeSortable; /* Dummy typedef */
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "gtktreednd.h"
|
#include "gtktreednd.h"
|
||||||
|
|
||||||
#define G_NODE(node) ((GNode *)node)
|
#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)
|
#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);
|
static void gtk_tree_store_init (GtkTreeStore *tree_store);
|
||||||
@ -2555,8 +2555,6 @@ gtk_tree_store_sort_helper (GtkTreeStore *tree_store,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_assert (GTK_TREE_STORE_IS_SORTED (tree_store));
|
|
||||||
|
|
||||||
list_length = 0;
|
list_length = 0;
|
||||||
for (tmp_node = node; tmp_node; tmp_node = tmp_node->next)
|
for (tmp_node = node; tmp_node; tmp_node = tmp_node->next)
|
||||||
list_length++;
|
list_length++;
|
||||||
@ -2615,6 +2613,9 @@ gtk_tree_store_sort_helper (GtkTreeStore *tree_store,
|
|||||||
static void
|
static void
|
||||||
gtk_tree_store_sort (GtkTreeStore *tree_store)
|
gtk_tree_store_sort (GtkTreeStore *tree_store)
|
||||||
{
|
{
|
||||||
|
if (!GTK_TREE_STORE_IS_SORTED (tree_store))
|
||||||
|
return;
|
||||||
|
|
||||||
if (tree_store->sort_column_id != -1)
|
if (tree_store->sort_column_id != -1)
|
||||||
{
|
{
|
||||||
GtkTreeDataSortHeader *header = NULL;
|
GtkTreeDataSortHeader *header = NULL;
|
||||||
@ -2857,19 +2858,22 @@ gtk_tree_store_set_sort_column_id (GtkTreeSortable *sortable,
|
|||||||
(tree_store->order == order))
|
(tree_store->order == order))
|
||||||
return;
|
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 */
|
/* We want to make sure that we have a function */
|
||||||
g_return_if_fail (header != NULL);
|
g_return_if_fail (header != NULL);
|
||||||
g_return_if_fail (header->func != NULL);
|
g_return_if_fail (header->func != NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_return_if_fail (tree_store->default_sort_func != NULL);
|
g_return_if_fail (tree_store->default_sort_func != NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tree_store->sort_column_id = sort_column_id;
|
tree_store->sort_column_id = sort_column_id;
|
||||||
|
Loading…
Reference in New Issue
Block a user