fix infinite dialog on network mount failure
This commit is contained in:
parent
24e34eaa0f
commit
95035166d3
3 changed files with 19 additions and 9 deletions
14
src/app.rs
14
src/app.rs
|
|
@ -2678,10 +2678,14 @@ impl Application for App {
|
|||
})
|
||||
&& let Some(mounter) = MOUNTERS.get(&key)
|
||||
{
|
||||
return mounter.network_drive(uri.clone()).map(move |()| {
|
||||
cosmic::Action::App(Message::NetworkDriveOpenEntityAfterMount {
|
||||
entity,
|
||||
})
|
||||
return mounter.network_drive(uri.clone()).map(move |mounted| {
|
||||
if mounted {
|
||||
cosmic::Action::App(Message::NetworkDriveOpenEntityAfterMount {
|
||||
entity,
|
||||
})
|
||||
} else {
|
||||
cosmic::action::none()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -3586,7 +3590,7 @@ impl Application for App {
|
|||
Some((*mounter_key, self.network_drive_input.clone()));
|
||||
return mounter
|
||||
.network_drive(self.network_drive_input.clone())
|
||||
.map(|()| cosmic::action::none());
|
||||
.map(|_| cosmic::action::none());
|
||||
}
|
||||
log::warn!(
|
||||
"no mounter found for connecting to {:?}",
|
||||
|
|
|
|||
|
|
@ -659,7 +659,7 @@ impl Mounter for Gvfs {
|
|||
)
|
||||
}
|
||||
|
||||
fn network_drive(&self, uri: String) -> Task<()> {
|
||||
fn network_drive(&self, uri: String) -> Task<bool> {
|
||||
let command_tx = self.command_tx.clone();
|
||||
Task::perform(
|
||||
async move {
|
||||
|
|
@ -668,9 +668,15 @@ impl Mounter for Gvfs {
|
|||
command_tx.send(Cmd::NetworkDrive(uri, res_tx)).unwrap();
|
||||
res_rx.await
|
||||
},
|
||||
|x| {
|
||||
if let Err(err) = x {
|
||||
|result| match result {
|
||||
Ok(Ok(())) => true,
|
||||
Ok(Err(err)) => {
|
||||
log::error!("{err:?}");
|
||||
false
|
||||
}
|
||||
Err(err) => {
|
||||
log::error!("{err:?}");
|
||||
false
|
||||
}
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ pub trait Mounter: Send + Sync {
|
|||
fn items(&self, sizes: IconSizes) -> Option<MounterItems>;
|
||||
//TODO: send result
|
||||
fn mount(&self, item: MounterItem) -> Task<()>;
|
||||
fn network_drive(&self, uri: String) -> Task<()>;
|
||||
fn network_drive(&self, uri: String) -> Task<bool>;
|
||||
fn network_scan(&self, uri: &str, sizes: IconSizes) -> Option<Result<Vec<tab::Item>, String>>;
|
||||
fn dir_info(&self, uri: &str) -> Option<(String, String, Option<PathBuf>)>;
|
||||
fn unmount(&self, item: MounterItem) -> Task<()>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue