[gtk+/wip/cosimoc/separator-deprecation: 4/8] treeview: don't use wide-separators/separator-height
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/cosimoc/separator-deprecation: 4/8] treeview: don't use wide-separators/separator-height
- Date: Wed, 30 Dec 2015 19:02:35 +0000 (UTC)
commit b95b150591882ee54d88e35cb463ff152f507d5a
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed Dec 30 10:36:28 2015 -0800
treeview: don't use wide-separators/separator-height
Those style properties are on their way out; instead, use min-height
with the separator style class to obtain the height.
gtk/gtktreeview.c | 40 ++++++++++++++++++++++-------
gtk/theme/Adwaita/_common.scss | 7 +++-
gtk/theme/Adwaita/gtk-contained-dark.css | 6 +++-
gtk/theme/Adwaita/gtk-contained.css | 6 +++-
4 files changed, 43 insertions(+), 16 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 52fd9d2..884e2dd 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -24,6 +24,7 @@
#include "gtktreeview.h"
#include "gtkadjustmentprivate.h"
+#include "gtkcssnumbervalueprivate.h"
#include "gtkrbtree.h"
#include "gtktreednd.h"
#include "gtktreeprivate.h"
@@ -6239,6 +6240,32 @@ node_is_visible (GtkTreeView *tree_view,
return FALSE;
}
+static gint
+get_separator_height (GtkTreeView *tree_view)
+{
+ GtkStyleContext *context;
+ GtkCssStyle *style;
+ gdouble d;
+ gint min_size;
+
+ context = gtk_widget_get_style_context (GTK_WIDGET (tree_view));
+ gtk_style_context_save (context);
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_SEPARATOR);
+
+ style = gtk_style_context_lookup_style (context);
+ d = _gtk_css_number_value_get
+ (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_MIN_HEIGHT), 100);
+
+ if (d < 1)
+ min_size = ceil (d);
+ else
+ min_size = floor (d);
+
+ gtk_style_context_restore (context);
+
+ return min_size;
+}
+
/* Returns TRUE if it updated the size
*/
static gboolean
@@ -6259,8 +6286,6 @@ validate_row (GtkTreeView *tree_view,
gboolean is_separator = FALSE;
gboolean draw_vgrid_lines, draw_hgrid_lines;
gint grid_line_width;
- gboolean wide_separators;
- gint separator_height;
gint expander_size;
/* double check the row needs validating */
@@ -6274,8 +6299,6 @@ validate_row (GtkTreeView *tree_view,
"horizontal-separator", &horizontal_separator,
"vertical-separator", &vertical_separator,
"grid-line-width", &grid_line_width,
- "wide-separators", &wide_separators,
- "separator-height", &separator_height,
NULL);
draw_vgrid_lines =
@@ -6328,12 +6351,9 @@ validate_row (GtkTreeView *tree_view,
NULL, &row_height);
if (is_separator)
- {
- if (wide_separators)
- height = separator_height;
- else
- height = 2;
- }
+ {
+ height = get_separator_height (tree_view);
+ }
else
{
row_height += vertical_separator;
diff --git a/gtk/theme/Adwaita/_common.scss b/gtk/theme/Adwaita/_common.scss
index 3dd623c..951d19a 100644
--- a/gtk/theme/Adwaita/_common.scss
+++ b/gtk/theme/Adwaita/_common.scss
@@ -1352,8 +1352,11 @@ treeview.view {
&:backdrop { color: $backdrop_insensitive_color; }
}
- &.separator:backdrop {
- color: transparentize(black, 0.9);
+ &.separator {
+ min-height: 2px;
+ &:backdrop {
+ color: transparentize(black, 0.9);
+ }
}
&:backdrop {
diff --git a/gtk/theme/Adwaita/gtk-contained-dark.css b/gtk/theme/Adwaita/gtk-contained-dark.css
index 0d6a130..70b7b4f 100644
--- a/gtk/theme/Adwaita/gtk-contained-dark.css
+++ b/gtk/theme/Adwaita/gtk-contained-dark.css
@@ -1998,8 +1998,10 @@ treeview.view {
color: #648eba; }
treeview.view:disabled:backdrop {
color: #5d6767; }
- treeview.view.separator:backdrop {
- color: rgba(0, 0, 0, 0.1); }
+ treeview.view.separator {
+ min-height: 2px; }
+ treeview.view.separator:backdrop {
+ color: rgba(0, 0, 0, 0.1); }
treeview.view:backdrop {
border-left-color: #676b6b;
border-top: #393f3f; }
diff --git a/gtk/theme/Adwaita/gtk-contained.css b/gtk/theme/Adwaita/gtk-contained.css
index c217e65..50703a0 100644
--- a/gtk/theme/Adwaita/gtk-contained.css
+++ b/gtk/theme/Adwaita/gtk-contained.css
@@ -1998,8 +1998,10 @@ treeview.view {
color: #80b1e4; }
treeview.view:disabled:backdrop {
color: #c3c3c0; }
- treeview.view.separator:backdrop {
- color: rgba(0, 0, 0, 0.1); }
+ treeview.view.separator {
+ min-height: 2px; }
+ treeview.view.separator:backdrop {
+ color: rgba(0, 0, 0, 0.1); }
treeview.view:backdrop {
border-left-color: #babbbb;
border-top: #e8e8e7; }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]