Skip to content

Commit

Permalink
fix #238: Astal.Slider page increment
Browse files Browse the repository at this point in the history
  • Loading branch information
Aylur committed Jan 12, 2025
1 parent 667040c commit 487f274
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/astal/gtk3/src/widget/slider.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});
Expand Down Expand Up @@ -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
}
12 changes: 12 additions & 0 deletions lib/astal/gtk4/src/widget/slider.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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; }
}
}

0 comments on commit 487f274

Please sign in to comment.