update recently used on file open
This commit is contained in:
parent
0d9780ae13
commit
65aea7671f
2 changed files with 20 additions and 6 deletions
|
|
@ -47,7 +47,7 @@ i18n-embed = { version = "0.14", features = [
|
|||
i18n-embed-fl = "0.7"
|
||||
rust-embed = "8"
|
||||
slotmap = "1.0.7"
|
||||
recently-used-xbel = "1.0.0"
|
||||
recently-used-xbel = "1.1.0"
|
||||
zip = "2.1.6"
|
||||
unix_permissions_ext = "0.1.2"
|
||||
users = "0.11.0"
|
||||
|
|
|
|||
24
src/app.rs
24
src/app.rs
|
|
@ -109,7 +109,7 @@ pub enum Action {
|
|||
ZoomDefault,
|
||||
ZoomIn,
|
||||
ZoomOut,
|
||||
Recents
|
||||
Recents,
|
||||
}
|
||||
|
||||
impl Action {
|
||||
|
|
@ -169,7 +169,7 @@ impl Action {
|
|||
Action::ZoomDefault => Message::TabMessage(entity_opt, tab::Message::ZoomDefault),
|
||||
Action::ZoomIn => Message::TabMessage(entity_opt, tab::Message::ZoomIn),
|
||||
Action::ZoomOut => Message::TabMessage(entity_opt, tab::Message::ZoomOut),
|
||||
Action::Recents => Message::Recents
|
||||
Action::Recents => Message::Recents,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -276,7 +276,7 @@ pub enum Message {
|
|||
DndExitTab,
|
||||
DndDropTab(Entity, Option<ClipboardPaste>, DndAction),
|
||||
DndDropNav(Entity, Option<ClipboardPaste>, DndAction),
|
||||
Recents
|
||||
Recents,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
|
|
@ -1592,7 +1592,14 @@ impl Application for App {
|
|||
Message::OpenWith(path, app) => {
|
||||
if let Some(mut command) = app.command(Some(path.clone())) {
|
||||
match spawn_detached(&mut command) {
|
||||
Ok(()) => {}
|
||||
Ok(()) => {
|
||||
let _ = recently_used_xbel::update_recently_used(
|
||||
&path,
|
||||
"org.cosmic.cosmic-files".to_string(),
|
||||
"cosmic-files".to_string(),
|
||||
None,
|
||||
);
|
||||
}
|
||||
Err(err) => {
|
||||
log::warn!("failed to open {:?} with {:?}: {}", path, app.id, err)
|
||||
}
|
||||
|
|
@ -1978,7 +1985,14 @@ impl Application for App {
|
|||
}
|
||||
tab::Command::OpenFile(item_path) => {
|
||||
match open::that_detached(&item_path) {
|
||||
Ok(()) => (),
|
||||
Ok(()) => {
|
||||
let _ = recently_used_xbel::update_recently_used(
|
||||
&item_path,
|
||||
"org.cosmic.cosmic-files".to_string(),
|
||||
"cosmic-files".to_string(),
|
||||
None,
|
||||
);
|
||||
}
|
||||
Err(err) => {
|
||||
log::warn!("failed to open {:?}: {}", item_path, err);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue