lazy_load: Add the ability to execute a callbakc on finish

When iteration of data is finished, None will be returned and
the or_else() block will be executed. Now a callback can be
passed that will be executd when the iteration/loading finishes.
This commit is contained in:
Jordan Petridis
2018-04-17 03:13:01 +03:00
parent 08365c412a
commit a0154c5919
2 changed files with 20 additions and 11 deletions
+4 -2
View File
@@ -399,9 +399,11 @@ pub fn episodes_listbox(pd: Arc<Podcast>, sender: Sender<Action>) -> Result<gtk:
Err(Disconnected) => return glib::Continue(false),
};
lazy_load(episodes, list.clone(), clone!(sender => move |ep| {
let constructor = clone!(sender => move |ep| {
EpisodeWidget::new(ep, sender.clone()).container
}));
});
lazy_load(episodes, list.clone(), constructor, || {});
glib::Continue(false)
}));