summaryrefslogtreecommitdiff
path: root/gtk/gtktreeviewcolumn.c
diff options
context:
space:
mode:
authorKristian Rietveld <kris@gtk.org>2006-05-28 12:37:21 +0000
committerKristian Rietveld <kristian@src.gnome.org>2006-05-28 12:37:21 +0000
commita22a9960af426c09692ee4837172d67e3c517e5e (patch)
tree66bc3a682dfc82b3d95ec3bad2aa1611ca6ce030 /gtk/gtktreeviewcolumn.c
parenta208b8b2a650903edf03549d7452e34c9af3e886 (diff)
downloadgtk+-a22a9960af426c09692ee4837172d67e3c517e5e.tar.gz
add GTK_ARROW_NONE.
2006-05-28 Kristian Rietveld <kris@gtk.org> * gtk/gtkenums.h: add GTK_ARROW_NONE. * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_update_column): always "show" the arrow if sort_column_id >= 0, only set arrow type if this column is the column we are currently sorting on. (#331338).
Diffstat (limited to 'gtk/gtktreeviewcolumn.c')
-rw-r--r--gtk/gtktreeviewcolumn.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c
index 97293ad956..c567731560 100644
--- a/gtk/gtktreeviewcolumn.c
+++ b/gtk/gtktreeviewcolumn.c
@@ -842,10 +842,12 @@ gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column)
static void
gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
{
+ gint sort_column_id;
GtkWidget *hbox;
GtkWidget *alignment;
GtkWidget *arrow;
GtkWidget *current_child;
+ GtkArrowType arrow_type = GTK_ARROW_NONE;
/* Create a button if necessary */
if (tree_column->visible &&
@@ -896,25 +898,33 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
"");
}
- switch (tree_column->sort_order)
+ if (gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (GTK_TREE_VIEW (tree_column->tree_view)->priv->model),
+ &sort_column_id,
+ NULL))
{
- case GTK_SORT_ASCENDING:
- gtk_arrow_set (GTK_ARROW (arrow),
- GTK_ARROW_DOWN,
- GTK_SHADOW_IN);
- break;
+ if (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:
- gtk_arrow_set (GTK_ARROW (arrow),
- GTK_ARROW_UP,
- GTK_SHADOW_IN);
- break;
+ case GTK_SORT_DESCENDING:
+ arrow_type = GTK_ARROW_UP;
+ break;
- default:
- g_warning (G_STRLOC": bad sort order");
- break;
+ default:
+ g_warning (G_STRLOC": bad sort order");
+ break;
+ }
+ }
}
+ gtk_arrow_set (GTK_ARROW (arrow),
+ arrow_type,
+ GTK_SHADOW_IN);
+
/* Put arrow on the right if the text is left-or-center justified, and on the
* left otherwise; do this by packing boxes, so flipping text direction will
* reverse things
@@ -934,7 +944,7 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
}
g_object_unref (arrow);
- if (tree_column->show_sort_indicator)
+ if (tree_column->sort_column_id >= 0)
gtk_widget_show (arrow);
else
gtk_widget_hide (arrow);