mirror of https://github.com/lapce/lapce.git
reload explorer after file change in it
This commit is contained in:
parent
c3bcc13172
commit
1008682d28
|
@ -647,7 +647,10 @@ fn event(
|
|||
menu = menu.entry(item);
|
||||
}
|
||||
|
||||
ctx.show_context_menu::<LapceData>(menu, mouse_event.pos);
|
||||
ctx.show_context_menu::<LapceData>(
|
||||
menu,
|
||||
ctx.to_window(mouse_event.pos),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1469,6 +1469,7 @@ fn handle_event(
|
|||
let path_c = path.clone();
|
||||
let event_sink = ctx.get_external_handle();
|
||||
let tab_id = data.id;
|
||||
let explorer = data.file_explorer.clone();
|
||||
data.proxy.create_file(
|
||||
path,
|
||||
Box::new(move |res| {
|
||||
|
@ -1488,14 +1489,16 @@ fn handle_event(
|
|||
);
|
||||
}
|
||||
}
|
||||
explorer.reload();
|
||||
}),
|
||||
);
|
||||
ctx.set_handled();
|
||||
}
|
||||
LapceUICommand::CreateDirectory { path } => {
|
||||
let explorer = data.file_explorer.clone();
|
||||
data.proxy.create_directory(
|
||||
path,
|
||||
Box::new(|res| {
|
||||
Box::new(move |res| {
|
||||
if let Err(err) = res {
|
||||
// TODO: Inform the user through a corner-notif
|
||||
log::warn!(
|
||||
|
@ -1503,30 +1506,35 @@ fn handle_event(
|
|||
err
|
||||
);
|
||||
}
|
||||
explorer.reload();
|
||||
}),
|
||||
);
|
||||
ctx.set_handled();
|
||||
}
|
||||
LapceUICommand::RenamePath { from, to } => {
|
||||
let explorer = data.file_explorer.clone();
|
||||
data.proxy.rename_path(
|
||||
from,
|
||||
to,
|
||||
Box::new(|res| {
|
||||
Box::new(move |res| {
|
||||
if let Err(err) = res {
|
||||
// TODO: inform the user through a corner-notif
|
||||
log::warn!("Failed to rename path: {:?}", err);
|
||||
}
|
||||
explorer.reload();
|
||||
}),
|
||||
);
|
||||
}
|
||||
LapceUICommand::TrashPath { path } => {
|
||||
let explorer = data.file_explorer.clone();
|
||||
data.proxy.trash_path(
|
||||
path,
|
||||
Box::new(|res| {
|
||||
Box::new(move |res| {
|
||||
if let Err(err) = res {
|
||||
// TODO: inform the user through a corner-notif
|
||||
log::warn!("Failed to trash path: {:?}", err);
|
||||
}
|
||||
explorer.reload();
|
||||
}),
|
||||
);
|
||||
ctx.set_handled();
|
||||
|
|
Loading…
Reference in New Issue