From 58d155d1e67e9a8b98be5d2417ec5ba49feb8444 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 18 May 2013 19:21:54 -0400 Subject: [PATCH] Fix drawing of treeview grid lines In the presence of invisible columns, the grid line drawing code was malfunctioning. https://bugzilla.gnome.org/show_bug.cgi?id=700578 --- gtk/gtktreeview.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index fb67860cab..52e36b1053 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -4733,8 +4733,7 @@ static void gtk_tree_view_draw_grid_lines (GtkTreeView *tree_view, cairo_t *cr) { - GList *list; - GtkTreeViewColumn *last; + GList *list, *first, *last; gboolean rtl; gint current_x = 0; @@ -4744,17 +4743,23 @@ gtk_tree_view_draw_grid_lines (GtkTreeView *tree_view, rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL); - for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns)), - last = (rtl ? g_list_first (tree_view->priv->columns) : g_list_last (tree_view->priv->columns))->data; + first = g_list_first (tree_view->priv->columns); + last = g_list_last (tree_view->priv->columns); + + for (list = (rtl ? last : first); list; list = (rtl ? list->prev : list->next)) { GtkTreeViewColumn *column = list->data; - current_x += gtk_tree_view_column_get_width (column); - /* We don't want a line for the last column */ - if (column == last) break; + if (column == (rtl ? first->data : last->data)) + break; + + if (!gtk_tree_view_column_get_visible (column)) + continue; + + current_x += gtk_tree_view_column_get_width (column); gtk_tree_view_draw_line (tree_view, cr, GTK_TREE_VIEW_GRID_LINE,