draw the indicator if the column has a sort column id (and the model is

2006-09-24  Kristian Rietveld  <kris@gtk.org>

	* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_update_button): draw
	the indicator if the column has a sort column id (and the model is
	sortable) or if the user explicitly requested the indicator
	to be shown.  (Fixes #352738, Chris Vine).
This commit is contained in:
Kristian Rietveld
2006-09-24 17:03:45 +00:00
committed by Kristian Rietveld
parent dbff4dd256
commit 2c72aad687
2 changed files with 30 additions and 22 deletions

View File

@ -1,3 +1,10 @@
2006-09-24 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_update_button): draw
the indicator if the column has a sort column id (and the model is
sortable) or if the user explicitly requested the indicator
to be shown. (Fixes #352738, Chris Vine).
2006-09-23 Tor Lillqvist <tml@novell.com>
* gtk/Makefile.am: Use EXEEXT.

View File

@ -843,7 +843,7 @@ gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column)
static void
gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
{
gint sort_column_id;
gint sort_column_id = -1;
GtkWidget *hbox;
GtkWidget *alignment;
GtkWidget *arrow;
@ -905,27 +905,27 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
"");
}
if (GTK_IS_TREE_SORTABLE (model)
&& gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (model),
&sort_column_id,
NULL))
{
if (sort_column_id == tree_column->sort_column_id)
{
switch (tree_column->sort_order)
{
case GTK_SORT_ASCENDING:
arrow_type = GTK_ARROW_DOWN;
break;
if (GTK_IS_TREE_SORTABLE (model))
gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (model),
&sort_column_id,
NULL);
case GTK_SORT_DESCENDING:
arrow_type = GTK_ARROW_UP;
break;
default:
g_warning (G_STRLOC": bad sort order");
break;
}
if (tree_column->show_sort_indicator
|| (sort_column_id >= 0 && sort_column_id == tree_column->sort_column_id))
{
switch (tree_column->sort_order)
{
case GTK_SORT_ASCENDING:
arrow_type = GTK_ARROW_DOWN;
break;
case GTK_SORT_DESCENDING:
arrow_type = GTK_ARROW_UP;
break;
default:
g_warning (G_STRLOC": bad sort order");
break;
}
}
@ -952,7 +952,8 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
}
g_object_unref (arrow);
if (GTK_IS_TREE_SORTABLE (model) && tree_column->sort_column_id >= 0)
if (tree_column->show_sort_indicator
|| (GTK_IS_TREE_SORTABLE (model) && tree_column->sort_column_id >= 0))
gtk_widget_show (arrow);
else
gtk_widget_hide (arrow);