summaryrefslogtreecommitdiff
path: root/lib/astal
diff options
context:
space:
mode:
Diffstat (limited to 'lib/astal')
-rw-r--r--lib/astal/gtk3/src/widget/slider.vala12
-rw-r--r--lib/astal/gtk4/src/widget/slider.vala12
2 files changed, 24 insertions, 0 deletions
diff --git a/lib/astal/gtk3/src/widget/slider.vala b/lib/astal/gtk3/src/widget/slider.vala
index 97cfb69..b927e32 100644
--- a/lib/astal/gtk3/src/widget/slider.vala
+++ b/lib/astal/gtk3/src/widget/slider.vala
@@ -30,6 +30,10 @@ public class Astal.Slider : Gtk.Scale {
step = 0.05;
}
+ if (page == 0) {
+ page = 0.01;
+ }
+
notify["orientation"].connect(() => {
notify_property("vertical");
});
@@ -90,5 +94,13 @@ public class Astal.Slider : Gtk.Scale {
set { adjustment.step_increment = value; }
}
+ /**
+ * Size of page increments. Defaults to `0.01`.
+ */
+ public double page {
+ get { return adjustment.page_increment; }
+ set { adjustment.page_increment = value; }
+ }
+
// TODO: marks
}
diff --git a/lib/astal/gtk4/src/widget/slider.vala b/lib/astal/gtk4/src/widget/slider.vala
index ca026a2..371f5be 100644
--- a/lib/astal/gtk4/src/widget/slider.vala
+++ b/lib/astal/gtk4/src/widget/slider.vala
@@ -14,6 +14,10 @@ public class Astal.Slider : Gtk.Scale {
step = 0.05;
}
+ if (page == 0) {
+ page = 0.01;
+ }
+
controller = new Gtk.EventControllerLegacy();
add_controller(controller);
controller.event.connect((event) => {
@@ -62,4 +66,12 @@ public class Astal.Slider : Gtk.Scale {
get { return adjustment.step_increment; }
set { adjustment.step_increment = value; }
}
+
+ /**
+ * Size of page increments. Defaults to `0.01`.
+ */
+ public double page {
+ get { return adjustment.page_increment; }
+ set { adjustment.page_increment = value; }
+ }
}