Fix unused tasks
This commit is contained in:
parent
8aa85ba1e3
commit
0a9bcdd5fd
1 changed files with 22 additions and 25 deletions
47
src/app.rs
47
src/app.rs
|
|
@ -682,7 +682,9 @@ pub struct App {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl App {
|
impl App {
|
||||||
fn open_file(&mut self, paths: &[impl AsRef<Path>]) {
|
fn open_file(&mut self, paths: &[impl AsRef<Path>]) -> Task<Message> {
|
||||||
|
let mut tasks = Vec::new();
|
||||||
|
|
||||||
// Associate all paths to its MIME type
|
// Associate all paths to its MIME type
|
||||||
// This allows handling paths as groups if possible, such as launching a single video
|
// This allows handling paths as groups if possible, such as launching a single video
|
||||||
// player that is passed every path.
|
// player that is passed every path.
|
||||||
|
|
@ -713,10 +715,11 @@ impl App {
|
||||||
Err(err) => match err.kind() {
|
Err(err) => match err.kind() {
|
||||||
io::ErrorKind::PermissionDenied => {
|
io::ErrorKind::PermissionDenied => {
|
||||||
// If permission is denied, try marking as executable, then running
|
// If permission is denied, try marking as executable, then running
|
||||||
self.dialog_pages
|
tasks.push(self.dialog_pages.push_back(
|
||||||
.push_back(DialogPage::SetExecutableAndLaunch {
|
DialogPage::SetExecutableAndLaunch {
|
||||||
path: path.to_path_buf(),
|
path: path.to_path_buf(),
|
||||||
});
|
},
|
||||||
|
));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
log::warn!("failed to execute {:?}: {}", path, err);
|
log::warn!("failed to execute {:?}: {}", path, err);
|
||||||
|
|
@ -759,6 +762,8 @@ impl App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Task::batch(tasks)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn launch_desktop_entries(paths: &[impl AsRef<Path>]) {
|
fn launch_desktop_entries(paths: &[impl AsRef<Path>]) {
|
||||||
|
|
@ -1060,17 +1065,16 @@ impl App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut tasks = Vec::new();
|
||||||
if !dialog_paths.is_empty() {
|
if !dialog_paths.is_empty() {
|
||||||
self.dialog_pages.push_back(DialogPage::PermanentlyDelete {
|
tasks.push(self.dialog_pages.push_back(DialogPage::PermanentlyDelete {
|
||||||
paths: dialog_paths,
|
paths: dialog_paths,
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
if !trash_paths.is_empty() {
|
if !trash_paths.is_empty() {
|
||||||
self.operation(Operation::Delete { paths: trash_paths })
|
tasks.push(self.operation(Operation::Delete { paths: trash_paths }));
|
||||||
} else {
|
|
||||||
Task::none()
|
|
||||||
}
|
}
|
||||||
|
Task::batch(tasks)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
|
@ -1464,6 +1468,7 @@ impl App {
|
||||||
Some(path),
|
Some(path),
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
|
println!("{:?}: {:?}", item.name(), item.uri());
|
||||||
b = b.data(Location::Network(item.uri().to_string(), item.name(), None));
|
b = b.data(Location::Network(item.uri().to_string(), item.name(), None));
|
||||||
}
|
}
|
||||||
if let Some(icon) = item.icon(true) {
|
if let Some(icon) = item.icon(true) {
|
||||||
|
|
@ -2319,30 +2324,27 @@ impl Application for App {
|
||||||
}
|
}
|
||||||
|
|
||||||
log::warn!("failed to open favorite, path does not exist: {:?}", path);
|
log::warn!("failed to open favorite, path does not exist: {:?}", path);
|
||||||
self.dialog_pages.push_back(DialogPage::FavoritePathError {
|
return self.dialog_pages.push_back(DialogPage::FavoritePathError {
|
||||||
path: path.clone(),
|
path: path.clone(),
|
||||||
entity,
|
entity,
|
||||||
});
|
});
|
||||||
false
|
|
||||||
}
|
}
|
||||||
Location::Path(path) | Location::Network(_, _, Some(path)) => {
|
Location::Path(path) | Location::Network(_, _, Some(path)) => {
|
||||||
match path.try_exists() {
|
match path.try_exists() {
|
||||||
Ok(true) => true,
|
Ok(true) => true,
|
||||||
Ok(false) => {
|
Ok(false) => {
|
||||||
log::warn!("failed to open favorite, path does not exist: {:?}", path);
|
log::warn!("failed to open favorite, path does not exist: {:?}", path);
|
||||||
self.dialog_pages.push_back(DialogPage::FavoritePathError {
|
return self.dialog_pages.push_back(DialogPage::FavoritePathError {
|
||||||
path: path.clone(),
|
path: path.clone(),
|
||||||
entity,
|
entity,
|
||||||
});
|
});
|
||||||
false
|
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::warn!("failed to open favorite for path: {:?}, {}", path, err);
|
log::warn!("failed to open favorite for path: {:?}, {}", path, err);
|
||||||
self.dialog_pages.push_back(DialogPage::FavoritePathError {
|
return self.dialog_pages.push_back(DialogPage::FavoritePathError {
|
||||||
path: path.clone(),
|
path: path.clone(),
|
||||||
entity,
|
entity,
|
||||||
});
|
});
|
||||||
false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3508,7 +3510,8 @@ impl Application for App {
|
||||||
Message::PermanentlyDelete(entity_opt) => {
|
Message::PermanentlyDelete(entity_opt) => {
|
||||||
let paths = self.selected_paths(entity_opt);
|
let paths = self.selected_paths(entity_opt);
|
||||||
if !paths.is_empty() {
|
if !paths.is_empty() {
|
||||||
self.dialog_pages
|
return self
|
||||||
|
.dialog_pages
|
||||||
.push_back(DialogPage::PermanentlyDelete { paths });
|
.push_back(DialogPage::PermanentlyDelete { paths });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3842,7 +3845,7 @@ impl Application for App {
|
||||||
cosmic::action::app(Message::TabMessage(Some(entity), x))
|
cosmic::action::app(Message::TabMessage(Some(entity), x))
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
tab::Command::OpenFile(paths) => self.open_file(&paths),
|
tab::Command::OpenFile(paths) => commands.push(self.open_file(&paths)),
|
||||||
tab::Command::OpenInNewTab(path) => {
|
tab::Command::OpenInNewTab(path) => {
|
||||||
commands.push(self.open_tab(Location::Path(path.clone()), false, None));
|
commands.push(self.open_tab(Location::Path(path.clone()), false, None));
|
||||||
}
|
}
|
||||||
|
|
@ -5595,13 +5598,7 @@ impl Application for App {
|
||||||
None => widget::vertical_space().into(),
|
None => widget::vertical_space().into(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut popover = widget::popover(tab_view);
|
tab_column = tab_column.push(tab_view);
|
||||||
/*
|
|
||||||
if let Some(dialog) = self.dialog() {
|
|
||||||
popover = popover.popup(dialog);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
tab_column = tab_column.push(popover);
|
|
||||||
|
|
||||||
// The toaster is added on top of an empty element to ensure that it does not override context menus
|
// The toaster is added on top of an empty element to ensure that it does not override context menus
|
||||||
tab_column =
|
tab_column =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue