diff options
author | Matthias Clasen <mclasen@redhat.com> | 2014-08-30 02:12:41 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2014-08-30 02:12:41 -0400 |
commit | a822abd3085ff328e050a9b77c2d4294532ed957 (patch) | |
tree | 0b02e65615abd1f3b54cc23b90b03bac5e93d0ac /gtk/gtktreeview.c | |
parent | 8c5eb9a0d62341a7f24da160806a6833cd972615 (diff) | |
download | gtk+-a822abd3085ff328e050a9b77c2d4294532ed957.tar.gz |
GtkTreeView: Don't hardcode black for tree lines
Use the left border color for tree lines. This is similar to
our use of top border color for grid lines. As a side-effect,
tree lines now get recolored when they are in a selected row.
https://bugzilla.gnome.org/show_bug.cgi?id=415415
Diffstat (limited to 'gtk/gtktreeview.c')
-rw-r--r-- | gtk/gtktreeview.c | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index da1526cb55..8cd2cb451d 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -4790,49 +4790,54 @@ gtk_tree_view_draw_line (GtkTreeView *tree_view, int x2, int y2) { + GtkStyleContext *context; + cairo_save (cr); + context = gtk_widget_get_style_context (GTK_WIDGET (tree_view)); + switch (type) { case GTK_TREE_VIEW_TREE_LINE: - cairo_set_source_rgb (cr, 0, 0, 0); - cairo_set_line_width (cr, tree_view->priv->tree_line_width); - if (tree_view->priv->tree_line_dashes[0]) - cairo_set_dash (cr, - tree_view->priv->tree_line_dashes, - 2, 0.5); + { + const GdkRGBA *color; + + color = _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_LEFT_COLOR)); + + gdk_cairo_set_source_rgba (cr, color); + cairo_set_line_width (cr, tree_view->priv->tree_line_width); + if (tree_view->priv->tree_line_dashes[0]) + cairo_set_dash (cr, tree_view->priv->tree_line_dashes, 2, 0.5); + } break; + case GTK_TREE_VIEW_GRID_LINE: { - GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (tree_view)); - const GdkRGBA *color = _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_COLOR)); + const GdkRGBA *color; + + color = _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_COLOR)); gdk_cairo_set_source_rgba (cr, color); cairo_set_line_width (cr, tree_view->priv->grid_line_width); if (tree_view->priv->grid_line_dashes[0]) - cairo_set_dash (cr, - tree_view->priv->grid_line_dashes, - 2, 0.5); + cairo_set_dash (cr, tree_view->priv->grid_line_dashes, 2, 0.5); } break; - default: - g_assert_not_reached (); - /* fall through */ case GTK_TREE_VIEW_FOREGROUND_LINE: { - GtkStyleContext *context; GtkStateFlags state; GdkRGBA color; - context = gtk_widget_get_style_context (GTK_WIDGET (tree_view)); state = gtk_widget_get_state_flags (GTK_WIDGET (tree_view)); - cairo_set_line_width (cr, 1.0); gtk_style_context_get_color (context, state, &color); gdk_cairo_set_source_rgba (cr, &color); } + break; + default: + g_assert_not_reached (); break; } |