mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
implement on_ready callback
This commit is contained in:
parent
df9e039dd2
commit
1c6e676557
3 changed files with 52 additions and 25 deletions
|
|
@ -7,20 +7,33 @@ pub struct Directory {
|
|||
|
||||
impl Directory {
|
||||
pub fn handle(&self, page: &Rc<super::Page>) {
|
||||
page.content.to_directory(&self.file, {
|
||||
let page = page.clone();
|
||||
move |file| {
|
||||
page.item_action.load.activate(
|
||||
Some(&format!(
|
||||
"file://{}",
|
||||
file.path().unwrap().to_str().unwrap()
|
||||
)),
|
||||
true,
|
||||
)
|
||||
}
|
||||
});
|
||||
page.content.to_directory(
|
||||
&self.file,
|
||||
(
|
||||
// on ready
|
||||
{
|
||||
let page = page.clone();
|
||||
move || {
|
||||
page.set_progress(0.0);
|
||||
}
|
||||
},
|
||||
// on activate
|
||||
{
|
||||
let page = page.clone();
|
||||
move |file| {
|
||||
page.item_action.load.activate(
|
||||
Some(&format!(
|
||||
"file://{}",
|
||||
file.path().unwrap().to_str().unwrap()
|
||||
)),
|
||||
true,
|
||||
)
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
page.set_title(&self.file.parse_name());
|
||||
page.set_progress(0.0);
|
||||
|
||||
page.window_action.find.simple_action.set_enabled(false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue