[gtk+] GtkTreeView: Don't hardcode black for tree lines
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkTreeView: Don't hardcode black for tree lines
- Date: Sat, 30 Aug 2014 06:14:14 +0000 (UTC)
commit a822abd3085ff328e050a9b77c2d4294532ed957
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Aug 30 02:12:41 2014 -0400
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
gtk/gtktreeview.c | 39 ++++++++++++++++++++++-----------------
1 files changed, 22 insertions(+), 17 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index da1526c..8cd2cb4 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]