diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 8 | ||||
-rw-r--r-- | gtk/gtkenums.h | 3 | ||||
-rw-r--r-- | gtk/gtktreeviewcolumn.c | 40 |
4 files changed, 43 insertions, 16 deletions
@@ -1,3 +1,11 @@ +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). + 2006-05-27 Matthias Clasen <mclasen@redhat.com> * gtk/gtkrecentchoosermenu.c: Avoid trivial differences diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 08121d15f3..ad489de56a 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +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). + 2006-05-27 Matthias Clasen <mclasen@redhat.com> * gtk/gtkrecentchoosermenu.c: Avoid trivial differences diff --git a/gtk/gtkenums.h b/gtk/gtkenums.h index 1c483de62b..89de9fa91c 100644 --- a/gtk/gtkenums.h +++ b/gtk/gtkenums.h @@ -59,7 +59,8 @@ typedef enum GTK_ARROW_UP, GTK_ARROW_DOWN, GTK_ARROW_LEFT, - GTK_ARROW_RIGHT + GTK_ARROW_RIGHT, + GTK_ARROW_NONE } GtkArrowType; /* Attach options (for tables) */ 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); |