treeview: Remove two _dashes members

Tree lines and grid lines always look the same these days.
This commit is contained in:
Timm Bäder 2019-08-09 20:22:01 +02:00
parent dd7d171186
commit 8a51796150

View File

@ -492,10 +492,7 @@ struct _GtkTreeViewPrivate
/* Grid and tree lines */ /* Grid and tree lines */
GtkTreeViewGridLines grid_lines; GtkTreeViewGridLines grid_lines;
double grid_line_dashes[2];
gboolean tree_lines_enabled; gboolean tree_lines_enabled;
double tree_line_dashes[2];
/* Row separators */ /* Row separators */
GtkTreeViewRowSeparatorFunc row_separator_func; GtkTreeViewRowSeparatorFunc row_separator_func;
@ -4269,8 +4266,7 @@ gtk_tree_view_snapshot_line (GtkTreeView *tree_view,
gdk_cairo_set_source_rgba (cr, color); gdk_cairo_set_source_rgba (cr, color);
cairo_set_line_width (cr, _TREE_VIEW_TREE_LINE_WIDTH); cairo_set_line_width (cr, _TREE_VIEW_TREE_LINE_WIDTH);
if (tree_view->priv->tree_line_dashes[0]) cairo_set_dash (cr, (double[]){ 1, 1 }, 2, 0.5);
cairo_set_dash (cr, tree_view->priv->tree_line_dashes, 2, 0.5);
} }
break; break;
@ -4282,8 +4278,7 @@ gtk_tree_view_snapshot_line (GtkTreeView *tree_view,
gdk_cairo_set_source_rgba (cr, color); gdk_cairo_set_source_rgba (cr, color);
cairo_set_line_width (cr, _TREE_VIEW_GRID_LINE_WIDTH); cairo_set_line_width (cr, _TREE_VIEW_GRID_LINE_WIDTH);
if (tree_view->priv->grid_line_dashes[0]) cairo_set_dash (cr, (double[]){ 1, 1 }, 2, 0.5);
cairo_set_dash (cr, tree_view->priv->grid_line_dashes, 2, 0.5);
} }
break; break;
@ -14552,26 +14547,14 @@ gtk_tree_view_set_grid_lines (GtkTreeView *tree_view,
GtkTreeViewGridLines grid_lines) GtkTreeViewGridLines grid_lines)
{ {
GtkTreeViewPrivate *priv; GtkTreeViewPrivate *priv;
GtkWidget *widget;
GtkTreeViewGridLines old_grid_lines; GtkTreeViewGridLines old_grid_lines;
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view)); g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
priv = tree_view->priv; priv = tree_view->priv;
widget = GTK_WIDGET (tree_view);
old_grid_lines = priv->grid_lines; old_grid_lines = priv->grid_lines;
priv->grid_lines = grid_lines; priv->grid_lines = grid_lines;
if (gtk_widget_get_realized (widget))
{
if (grid_lines != GTK_TREE_VIEW_GRID_LINES_NONE &&
_TREE_VIEW_GRID_LINE_WIDTH > 0)
{
priv->grid_line_dashes[0] = 1;
priv->grid_line_dashes[1] = 1;
}
}
if (old_grid_lines != grid_lines) if (old_grid_lines != grid_lines)
{ {
@ -14611,7 +14594,6 @@ gtk_tree_view_set_enable_tree_lines (GtkTreeView *tree_view,
gboolean enabled) gboolean enabled)
{ {
GtkTreeViewPrivate *priv; GtkTreeViewPrivate *priv;
GtkWidget *widget;
gboolean was_enabled; gboolean was_enabled;
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view)); g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
@ -14619,21 +14601,11 @@ gtk_tree_view_set_enable_tree_lines (GtkTreeView *tree_view,
enabled = enabled != FALSE; enabled = enabled != FALSE;
priv = tree_view->priv; priv = tree_view->priv;
widget = GTK_WIDGET (tree_view);
was_enabled = priv->tree_lines_enabled; was_enabled = priv->tree_lines_enabled;
priv->tree_lines_enabled = enabled; priv->tree_lines_enabled = enabled;
if (gtk_widget_get_realized (widget))
{
if (enabled && _TREE_VIEW_TREE_LINE_WIDTH > 0)
{
priv->tree_line_dashes[0] = 1;
priv->tree_line_dashes[1] = 1;
}
}
if (was_enabled != enabled) if (was_enabled != enabled)
{ {
gtk_widget_queue_draw (GTK_WIDGET (tree_view)); gtk_widget_queue_draw (GTK_WIDGET (tree_view));