[gtk+/wip/cosimoc/range-gadget] scrollbar: deprecate min-slider-length style property



commit ba442bd0b4e8101444a47d0ac30347590be9ce0d
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Feb 22 22:00:57 2016 -0800

    scrollbar: deprecate min-slider-length style property
    
    In favor of min-height/min-width, like we did for other similar
    properties.

 gtk/gtkscrollbar.c                       |   18 ++++++++++++++++--
 gtk/theme/Adwaita/_common.scss           |    5 ++---
 gtk/theme/Adwaita/gtk-contained-dark.css |    7 ++++---
 gtk/theme/Adwaita/gtk-contained.css      |    7 ++++---
 4 files changed, 26 insertions(+), 11 deletions(-)
---
diff --git a/gtk/gtkscrollbar.c b/gtk/gtkscrollbar.c
index 06ddc50..1656415 100644
--- a/gtk/gtkscrollbar.c
+++ b/gtk/gtkscrollbar.c
@@ -30,6 +30,7 @@
 
 #include "gtkadjustment.h"
 #include "gtkintl.h"
+#include "gtkorientable.h"
 #include "gtkprivate.h"
 
 
@@ -92,6 +93,14 @@ gtk_scrollbar_class_init (GtkScrollbarClass *class)
 
   widget_class->style_updated = gtk_scrollbar_style_updated;
 
+  /**
+   * GtkScrollbar:min-slider-length:
+   *
+   * Minimum length of scrollbar slider.
+   *
+   * Deprecated: 3.20: Use min-height/min-width CSS properties on the slider
+   *   element instead. The value of this style property is ignored.
+   */
   gtk_widget_class_install_style_property (widget_class,
                                           g_param_spec_int ("min-slider-length",
                                                             P_("Minimum Slider Length"),
@@ -99,7 +108,7 @@ gtk_scrollbar_class_init (GtkScrollbarClass *class)
                                                             0,
                                                             G_MAXINT,
                                                             21,
-                                                            GTK_PARAM_READABLE));
+                                                            GTK_PARAM_READABLE|G_PARAM_DEPRECATED));
 
   gtk_widget_class_install_style_property (widget_class,
                                           g_param_spec_boolean ("fixed-slider-length",
@@ -148,9 +157,14 @@ gtk_scrollbar_update_style (GtkScrollbar *scrollbar)
   gboolean has_a, has_b, has_c, has_d;
   GtkRange *range = GTK_RANGE (scrollbar);
   GtkWidget *widget = GTK_WIDGET (scrollbar);
+  GtkCssGadget *slider_gadget = gtk_range_get_slider_gadget (range);
+
+  gtk_css_gadget_get_preferred_size (slider_gadget,
+                                     gtk_orientable_get_orientation (GTK_ORIENTABLE (scrollbar)), -1,
+                                     &slider_length, NULL,
+                                     NULL, NULL);
 
   gtk_widget_style_get (widget,
-                        "min-slider-length", &slider_length,
                         "fixed-slider-length", &fixed_size,
                         "has-backward-stepper", &has_a,
                         "has-secondary-forward-stepper", &has_b,
diff --git a/gtk/theme/Adwaita/_common.scss b/gtk/theme/Adwaita/_common.scss
index d92de08..99ff57c 100644
--- a/gtk/theme/Adwaita/_common.scss
+++ b/gtk/theme/Adwaita/_common.scss
@@ -2015,9 +2015,6 @@ scrollbar {
   @at-root * {
     -GtkScrollbar-has-backward-stepper: false;
     -GtkScrollbar-has-forward-stepper: false;
-    -GtkScrollbar-min-slider-length: 42; // minimum size for the slider.
-                                         // sadly can't be in '.slider'
-                                         // where it belongs
   }
 
   $_slider_margin: 3px;
@@ -2113,6 +2110,7 @@ scrollbar {
   &.vertical {
     slider {
       margin-left: 1px + $_slider_margin;
+      min-height: 42px;
       min-width: 6px;
 
       &:dir(rtl) {
@@ -2144,6 +2142,7 @@ scrollbar {
     slider {
       margin-top: 1px + $_slider_margin;
       min-height: 6px;
+      min-width: 42px;
     }
 
     &.fine-tune slider { margin-top: 1px + $_slider_fine_tune_margin; }
diff --git a/gtk/theme/Adwaita/gtk-contained-dark.css b/gtk/theme/Adwaita/gtk-contained-dark.css
index 1c07ad0..cd6770a 100644
--- a/gtk/theme/Adwaita/gtk-contained-dark.css
+++ b/gtk/theme/Adwaita/gtk-contained-dark.css
@@ -2226,8 +2226,7 @@ notebook > stack:not(:only-child) {
  **************/
 * {
   -GtkScrollbar-has-backward-stepper: false;
-  -GtkScrollbar-has-forward-stepper: false;
-  -GtkScrollbar-min-slider-length: 42; }
+  -GtkScrollbar-has-forward-stepper: false; }
 scrollbar button {
   border: none; }
 scrollbar.vertical button.down {
@@ -2281,6 +2280,7 @@ scrollbar.fine-tune slider {
   margin: 4px; }
 scrollbar.vertical slider {
   margin-left: 4px;
+  min-height: 42px;
   min-width: 6px; }
   scrollbar.vertical slider:dir(rtl) {
     margin-left: 3px;
@@ -2297,7 +2297,8 @@ scrollbar.vertical trough {
     border-right-style: solid; }
 scrollbar.horizontal slider {
   margin-top: 4px;
-  min-height: 6px; }
+  min-height: 6px;
+  min-width: 42px; }
 scrollbar.horizontal.fine-tune slider {
   margin-top: 5px; }
 scrollbar.horizontal trough {
diff --git a/gtk/theme/Adwaita/gtk-contained.css b/gtk/theme/Adwaita/gtk-contained.css
index 7e528ff..7387e02 100644
--- a/gtk/theme/Adwaita/gtk-contained.css
+++ b/gtk/theme/Adwaita/gtk-contained.css
@@ -2236,8 +2236,7 @@ notebook > stack:not(:only-child) {
  **************/
 * {
   -GtkScrollbar-has-backward-stepper: false;
-  -GtkScrollbar-has-forward-stepper: false;
-  -GtkScrollbar-min-slider-length: 42; }
+  -GtkScrollbar-has-forward-stepper: false; }
 scrollbar button {
   border: none; }
 scrollbar.vertical button.down {
@@ -2291,6 +2290,7 @@ scrollbar.fine-tune slider {
   margin: 4px; }
 scrollbar.vertical slider {
   margin-left: 4px;
+  min-height: 42px;
   min-width: 6px; }
   scrollbar.vertical slider:dir(rtl) {
     margin-left: 3px;
@@ -2307,7 +2307,8 @@ scrollbar.vertical trough {
     border-right-style: solid; }
 scrollbar.horizontal slider {
   margin-top: 4px;
-  min-height: 6px; }
+  min-height: 6px;
+  min-width: 42px; }
 scrollbar.horizontal.fine-tune slider {
   margin-top: 5px; }
 scrollbar.horizontal trough {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]