Do not pass some things by value when not needed.
This commit is contained in:
parent
8951a6e237
commit
00d9019f29
@ -104,7 +104,7 @@ where
|
||||
|
||||
// Kudos to Julian Sparber
|
||||
// https://blogs.gnome.org/jsparber/2018/04/29/animate-a-scrolledwindow/
|
||||
pub fn smooth_scroll_to(view: gtk::ScrolledWindow, target: gtk::Adjustment) {
|
||||
pub fn smooth_scroll_to(view: >k::ScrolledWindow, target: >k::Adjustment) {
|
||||
if let Some(adj) = view.get_vadjustment() {
|
||||
if let Some(clock) = view.get_frame_clock() {
|
||||
let duration = 200;
|
||||
@ -119,10 +119,10 @@ pub fn smooth_scroll_to(view: gtk::ScrolledWindow, target: gtk::Adjustment) {
|
||||
let mut t = (now - start_time) as f64 / (end_time - start_time) as f64;
|
||||
t = ease_out_cubic(t);
|
||||
adj.set_value(start + t * (end - start));
|
||||
return glib::Continue(true);
|
||||
glib::Continue(true)
|
||||
} else {
|
||||
adj.set_value(end);
|
||||
return glib::Continue(false);
|
||||
glib::Continue(false)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ impl HomeView {
|
||||
// Copy the vertical scrollbar adjustment from the old view into the new one.
|
||||
sendcell
|
||||
.try_get()
|
||||
.map(|x| utils::smooth_scroll_to(self.scrolled_window.clone(), x.clone()));
|
||||
.map(|x| utils::smooth_scroll_to(&self.scrolled_window, &x));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
@ -165,7 +165,7 @@ impl ShowWidget {
|
||||
// Copy the vertical scrollbar adjustment from the old view into the new one.
|
||||
sendcell
|
||||
.try_get()
|
||||
.map(|x| utils::smooth_scroll_to(self.scrolled_window.clone(), x.clone()));
|
||||
.map(|x| utils::smooth_scroll_to(&self.scrolled_window, &x));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
Loading…
Reference in New Issue
Block a user