diff options
author | Matthias Clasen <mclasen@redhat.com> | 2013-05-18 19:21:54 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2013-05-18 19:21:54 -0400 |
commit | 58d155d1e67e9a8b98be5d2417ec5ba49feb8444 (patch) | |
tree | 6ee59f9b09e01d118c98ffb754b74c6696ebfc85 /gtk/gtktreeview.c | |
parent | 41b07bdc96a3738644fbb09827fb8a36877b8d44 (diff) | |
download | gtk+-58d155d1e67e9a8b98be5d2417ec5ba49feb8444.tar.gz |
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
Diffstat (limited to 'gtk/gtktreeview.c')
-rw-r--r-- | gtk/gtktreeview.c | 19 |
1 files 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, |