remove incorrect async features implementation

This commit is contained in:
yggverse 2025-07-23 02:13:48 +03:00
parent f831212d40
commit e2b0cd6b0d
2 changed files with 25 additions and 39 deletions

View File

@ -41,17 +41,11 @@ impl Bookmark {
let profile = self.profile.clone();
let query = self.request.text();
let title = title.map(|t| t.to_string());
gtk::glib::spawn_future_local(async move {
button.set_sensitive(false); // lock
let has_bookmark = gtk::gio::spawn_blocking(move || {
profile.bookmark.toggle(&query, title.as_deref()).unwrap()
})
.await
.unwrap();
let has_bookmark = profile.bookmark.toggle(&query, title.as_deref()).unwrap();
button.set_icon_name(icon_name(has_bookmark));
button.set_tooltip_text(Some(tooltip_text(has_bookmark)));
button.set_sensitive(true);
}); // may take a while
}
}
@ -76,10 +70,7 @@ fn update(profile: &Arc<Profile>, button: &Button, request: gtk::glib::GString)
let button = button.clone();
gtk::glib::spawn_future_local(async move {
button.set_sensitive(false); // lock
let has_bookmark =
gtk::gio::spawn_blocking(move || profile.bookmark.is_match_request(&request))
.await
.unwrap();
let has_bookmark = profile.bookmark.is_match_request(&request);
button.set_icon_name(icon_name(has_bookmark));
button.set_tooltip_text(Some(tooltip_text(has_bookmark)));
button.set_sensitive(true);

View File

@ -170,9 +170,7 @@ impl Suggestion {
let list_store = self.list_store.clone();
let profile = self.profile.clone();
gtk::glib::spawn_future_local(async move {
let list_items: Vec<(GString, GString, bool, GString)> =
gtk::gio::spawn_blocking(move || {
profile
let list_items: Vec<(GString, GString, bool, GString)> = profile
.history
.contains_request(&query, limit)
.into_iter()
@ -191,10 +189,7 @@ impl Suggestion {
)
})
.sorted_by(|a, b| Ord::cmp(&b.2, &a.2)) // bookmark first
.collect()
})
.await
.unwrap();
.collect();
if list_items.is_empty() {
popover.popdown();
} else {