mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
update list_items collector
This commit is contained in:
parent
d6018dc66a
commit
1d69dca1c5
1 changed files with 15 additions and 18 deletions
|
|
@ -172,27 +172,24 @@ impl Suggestion {
|
||||||
gtk::glib::spawn_future_local(async move {
|
gtk::glib::spawn_future_local(async move {
|
||||||
let list_items: Vec<(GString, GString, bool, GString)> =
|
let list_items: Vec<(GString, GString, bool, GString)> =
|
||||||
gtk::gio::spawn_blocking(move || {
|
gtk::gio::spawn_blocking(move || {
|
||||||
let result = profile
|
profile
|
||||||
.history
|
.history
|
||||||
.contains_request(&query, limit)
|
.contains_request(&query, limit)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.sorted_by(|a, b| Ord::cmp(&b.opened.count, &a.opened.count));
|
.sorted_by(|a, b| Ord::cmp(&b.opened.count, &a.opened.count))
|
||||||
let mut list_items = Vec::with_capacity(result.len());
|
.map(|item| {
|
||||||
for item in result {
|
let subtitle = highlight(&item.request, &query);
|
||||||
let subtitle = highlight(&item.request, &query);
|
let title = match item.title {
|
||||||
let title = match item.title {
|
Some(title) => highlight(&title, &query),
|
||||||
Some(title) => highlight(&title, &query),
|
None => subtitle.clone(),
|
||||||
None => subtitle.clone(),
|
};
|
||||||
};
|
(
|
||||||
list_items.push((
|
title,
|
||||||
title,
|
subtitle,
|
||||||
subtitle,
|
profile.bookmark.is_match_request(&item.request),
|
||||||
profile.bookmark.is_match_request(&item.request),
|
item.request,
|
||||||
item.request,
|
)
|
||||||
))
|
})
|
||||||
}
|
|
||||||
list_items
|
|
||||||
.into_iter()
|
|
||||||
.sorted_by(|a, b| Ord::cmp(&b.2, &a.2)) // bookmark first
|
.sorted_by(|a, b| Ord::cmp(&b.2, &a.2)) // bookmark first
|
||||||
.collect()
|
.collect()
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue