[gtk+] Fix drawing of treeview grid lines
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Fix drawing of treeview grid lines
- Date: Sat, 18 May 2013 23:21:29 +0000 (UTC)
commit 58d155d1e67e9a8b98be5d2417ec5ba49feb8444
Author: Matthias Clasen <mclasen redhat com>
Date: Sat May 18 19:21:54 2013 -0400
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 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index fb67860..52e36b1 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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]