[gnome-control-center/wip/carlosg/wacom-pressure-steps: 265/265] wacom: Snap tip/eraser pressure feel to the allowed values



commit c9ef4fee0f8fed06c80fa4f26502b99977358937
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Apr 24 16:46:41 2019 +0200

    wacom: Snap tip/eraser pressure feel to the allowed values
    
    And add markers for those. We only allow a total of 7 fixed pressure curve
    values, so make the UI clear about it.
    
    Closes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/483

 panels/wacom/cc-wacom-stylus-page.c | 12 ++++++++++++
 panels/wacom/wacom-stylus-page.ui   |  2 ++
 2 files changed, 14 insertions(+)
---
diff --git a/panels/wacom/cc-wacom-stylus-page.c b/panels/wacom/cc-wacom-stylus-page.c
index 5bbbfa601..835a9440a 100644
--- a/panels/wacom/cc-wacom-stylus-page.c
+++ b/panels/wacom/cc-wacom-stylus-page.c
@@ -258,6 +258,15 @@ cc_wacom_stylus_page_class_init (CcWacomStylusPageClass *klass)
        object_class->dispose = cc_wacom_stylus_page_dispose;
 }
 
+static void
+add_marks (GtkScale *scale)
+{
+       gint i;
+
+       for (i = 0; i < N_PRESSURE_CURVES; i++)
+               gtk_scale_add_mark (scale, i, GTK_POS_BOTTOM, NULL);
+}
+
 static void
 cc_wacom_stylus_page_init (CcWacomStylusPage *page)
 {
@@ -287,6 +296,9 @@ cc_wacom_stylus_page_init (CcWacomStylusPage *page)
        gtk_container_add (GTK_CONTAINER (page), box);
        gtk_widget_set_vexpand (GTK_WIDGET (box), TRUE);
 
+       add_marks (GTK_SCALE (WID ("scale-tip-feel")));
+       add_marks (GTK_SCALE (WID ("scale-eraser-feel")));
+
        g_signal_connect (WID ("scale-tip-feel"), "value-changed",
                          G_CALLBACK (tip_feel_value_changed_cb), page);
        g_signal_connect (WID ("scale-eraser-feel"), "value-changed",
diff --git a/panels/wacom/wacom-stylus-page.ui b/panels/wacom/wacom-stylus-page.ui
index 6e2627bc4..133f3c8fb 100644
--- a/panels/wacom/wacom-stylus-page.ui
+++ b/panels/wacom/wacom-stylus-page.ui
@@ -196,6 +196,7 @@
                     <property name="adjustment">adjustment-eraser-feel</property>
                     <property name="digits">0</property>
                     <property name="draw_value">False</property>
+                    <property name="round_digits">0</property>
                   </object>
                   <packing>
                     <property name="expand">True</property>
@@ -356,6 +357,7 @@
                     <property name="adjustment">adjustment-tip-feel</property>
                     <property name="digits">0</property>
                     <property name="draw_value">False</property>
+                    <property name="round_digits">0</property>
                   </object>
                   <packing>
                     <property name="expand">True</property>


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