Skip to content

Commit

Permalink
chore: use if let chain downcast eventcontroller flags
Browse files Browse the repository at this point in the history
Signed-off-by: tsukinaha <sakuovds@gmail.com>
  • Loading branch information
tsukinaha committed Nov 16, 2024
1 parent 5212660 commit c706077
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/ui/widgets/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ pub trait ScrolledWindowFixExt {
/// fix scrolledwindow fucking up the vscroll event
impl ScrolledWindowFixExt for ScrolledWindow {
fn fix(&self) -> &Self {
let controller = self.observe_controllers();
let count = controller.n_items();
for i in 0..count {
let item = controller.item(i).unwrap();
if item.is::<gtk::EventControllerScroll>() {
let controller = item.downcast::<gtk::EventControllerScroll>().unwrap();
let controller_model = self.observe_controllers();
for i in 0..controller_model.n_items() {
if let Some(controller) = controller_model
.item(i)
.and_downcast_ref::<gtk::EventControllerScroll>()
{
controller.set_flags(
gtk::EventControllerScrollFlags::HORIZONTAL
| gtk::EventControllerScrollFlags::KINETIC,
Expand Down

0 comments on commit c706077

Please sign in to comment.