treeview: Use CSS property "border-top-color" to draw grid lines

This allows themes to customize the grid line colors in treeviews.

https://bugzilla.gnome.org/show_bug.cgi?id=415415
This commit is contained in:
Jonh Wendell 2013-11-18 17:15:12 -02:00
parent fb9ff44299
commit 7b85d1df50

View File

@ -49,6 +49,7 @@
#include "gtkentryprivate.h" #include "gtkentryprivate.h"
#include "gtkstylecontextprivate.h" #include "gtkstylecontextprivate.h"
#include "gtkcssstylepropertyprivate.h" #include "gtkcssstylepropertyprivate.h"
#include "gtkcssrgbavalueprivate.h"
#include "gtktypebuiltins.h" #include "gtktypebuiltins.h"
#include "gtkmain.h" #include "gtkmain.h"
#include "gtksettings.h" #include "gtksettings.h"
@ -4689,13 +4690,19 @@ gtk_tree_view_draw_line (GtkTreeView *tree_view,
2, 0.5); 2, 0.5);
break; break;
case GTK_TREE_VIEW_GRID_LINE: case GTK_TREE_VIEW_GRID_LINE:
cairo_set_source_rgb (cr, 0, 0, 0); {
cairo_set_line_width (cr, tree_view->priv->grid_line_width); GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (tree_view));
if (tree_view->priv->grid_line_dashes[0]) const GdkRGBA *color = _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_COLOR));
cairo_set_dash (cr,
tree_view->priv->grid_line_dashes, gdk_cairo_set_source_rgba (cr, color);
2, 0.5); 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);
}
break; break;
default: default:
g_assert_not_reached (); g_assert_not_reached ();
/* fall through */ /* fall through */