update recently used on dialog open

This commit is contained in:
Francesco-gaglione 2024-09-03 00:09:49 +02:00
parent dc5842e5d5
commit da52e8aa6e

View file

@ -25,6 +25,7 @@ use notify_debouncer_full::{
notify::{self, RecommendedWatcher, Watcher},
DebouncedEvent, Debouncer, FileIdMap,
};
use recently_used_xbel::update_recently_used;
use std::{
any::TypeId,
collections::{HashMap, HashSet},
@ -440,7 +441,7 @@ impl Application for App {
let accept_label = flags.kind.accept_label();
let mut nav_model = segmented_button::ModelBuilder::default();
nav_model = nav_model.insert(move |b| {
b.text(fl!("recents"))
.icon(widget::icon::from_name("accessories-clock-symbolic").size(16))
@ -673,6 +674,12 @@ impl Application for App {
if item.selected {
if let Some(path) = &item.path_opt {
paths.push(path.clone());
let _ = update_recently_used(
&path.clone(),
App::APP_ID.to_string(),
"cosmic-files".to_string(),
None,
);
}
}
}