diff options
author | Jonathan Blandford <jrb@redhat.com> | 2001-03-28 01:54:14 +0000 |
---|---|---|
committer | Jonathan Blandford <jrb@src.gnome.org> | 2001-03-28 01:54:14 +0000 |
commit | 88bbc2a534d07b6973c1ecd0979baae14a23e019 (patch) | |
tree | ab3006261952a0682fc0952b558bb8285d497fa1 /gtk/gtktreedatalist.c | |
parent | 2c613ffd95fd25dceea8173271f3fbc488321cd9 (diff) | |
download | gtk+-88bbc2a534d07b6973c1ecd0979baae14a23e019.tar.gz |
More work on implementing sortable interface.
Tue Mar 27 20:55:29 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkliststore.c: More work on implementing sortable
interface.
Diffstat (limited to 'gtk/gtktreedatalist.c')
-rw-r--r-- | gtk/gtktreedatalist.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/gtk/gtktreedatalist.c b/gtk/gtktreedatalist.c index 0bf6152665..81596e6ede 100644 --- a/gtk/gtktreedatalist.c +++ b/gtk/gtktreedatalist.c @@ -264,7 +264,8 @@ gtk_tree_data_list_compare_func (GtkTreeModel *model, GValue a_value = {0, }; GValue b_value = {0, }; gint retval; - + gchar *stra, *strb; + gtk_tree_model_get_value (model, a, column, &a_value); gtk_tree_model_get_value (model, b, column, &b_value); @@ -299,7 +300,13 @@ gtk_tree_data_list_compare_func (GtkTreeModel *model, retval = (g_value_get_double (&a_value) < g_value_get_double (&b_value)); break; case G_TYPE_STRING: - retval = strcmp (g_value_get_string (&a_value), g_value_get_string (&b_value)); + stra = g_value_get_string (&a_value); + strb = g_value_get_string (&b_value); + if (stra == NULL) + stra = ""; + if (strb == NULL) + strb = ""; + retval = strcmp (stra, strb); break; case G_TYPE_POINTER: case G_TYPE_BOXED: @@ -356,3 +363,18 @@ _gtk_tree_data_list_header_free (GList *list) } g_list_free (list); } + +GtkTreeDataSortHeader * +_gtk_tree_data_list_get_header (GList *header_list, + gint sort_column_id) +{ + GtkTreeDataSortHeader *header = NULL; + + for (; header_list; header_list = header_list->next) + { + header = (GtkTreeDataSortHeader*) header_list->data; + if (header->sort_column_id == sort_column_id) + return header; + } + return NULL; +} |