tree model sort: Fix set_sort_column

We were failing to change the sort order for the
default sort column in some cases. Fix that, and
add a testcase for this issue.

https://bugzilla.gnome.org/show_bug.cgi?id=792459

Add a testcase for the previous fix
This commit is contained in:
Matthias Clasen
2018-01-16 18:16:21 -05:00
parent e1aeb73a62
commit 53bc2566b3
2 changed files with 92 additions and 11 deletions

View File

@ -1684,6 +1684,9 @@ gtk_tree_model_sort_set_sort_column_id (GtkTreeSortable *sortable,
GtkTreeModelSort *tree_model_sort = (GtkTreeModelSort *)sortable;
GtkTreeModelSortPrivate *priv = tree_model_sort->priv;
if (priv->sort_column_id == sort_column_id && priv->order == order)
return;
if (sort_column_id != GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID)
{
if (sort_column_id != GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID)
@ -1699,17 +1702,6 @@ gtk_tree_model_sort_set_sort_column_id (GtkTreeSortable *sortable,
}
else
g_return_if_fail (priv->default_sort_func != NULL);
if (priv->sort_column_id == sort_column_id)
{
if (sort_column_id != GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID)
{
if (priv->order == order)
return;
}
else
return;
}
}
priv->sort_column_id = sort_column_id;