mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-09-09 21:41:54 +00:00
remove incorrect async features implementation
This commit is contained in:
parent
f831212d40
commit
e2b0cd6b0d
@ -41,17 +41,11 @@ impl Bookmark {
|
|||||||
let profile = self.profile.clone();
|
let profile = self.profile.clone();
|
||||||
let query = self.request.text();
|
let query = self.request.text();
|
||||||
let title = title.map(|t| t.to_string());
|
let title = title.map(|t| t.to_string());
|
||||||
gtk::glib::spawn_future_local(async move {
|
|
||||||
button.set_sensitive(false); // lock
|
button.set_sensitive(false); // lock
|
||||||
let has_bookmark = gtk::gio::spawn_blocking(move || {
|
let has_bookmark = profile.bookmark.toggle(&query, title.as_deref()).unwrap();
|
||||||
profile.bookmark.toggle(&query, title.as_deref()).unwrap()
|
|
||||||
})
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
button.set_icon_name(icon_name(has_bookmark));
|
button.set_icon_name(icon_name(has_bookmark));
|
||||||
button.set_tooltip_text(Some(tooltip_text(has_bookmark)));
|
button.set_tooltip_text(Some(tooltip_text(has_bookmark)));
|
||||||
button.set_sensitive(true);
|
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();
|
let button = button.clone();
|
||||||
gtk::glib::spawn_future_local(async move {
|
gtk::glib::spawn_future_local(async move {
|
||||||
button.set_sensitive(false); // lock
|
button.set_sensitive(false); // lock
|
||||||
let has_bookmark =
|
let has_bookmark = profile.bookmark.is_match_request(&request);
|
||||||
gtk::gio::spawn_blocking(move || profile.bookmark.is_match_request(&request))
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
button.set_icon_name(icon_name(has_bookmark));
|
button.set_icon_name(icon_name(has_bookmark));
|
||||||
button.set_tooltip_text(Some(tooltip_text(has_bookmark)));
|
button.set_tooltip_text(Some(tooltip_text(has_bookmark)));
|
||||||
button.set_sensitive(true);
|
button.set_sensitive(true);
|
||||||
|
@ -170,9 +170,7 @@ impl Suggestion {
|
|||||||
let list_store = self.list_store.clone();
|
let list_store = self.list_store.clone();
|
||||||
let profile = self.profile.clone();
|
let profile = self.profile.clone();
|
||||||
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)> = profile
|
||||||
gtk::gio::spawn_blocking(move || {
|
|
||||||
profile
|
|
||||||
.history
|
.history
|
||||||
.contains_request(&query, limit)
|
.contains_request(&query, limit)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
@ -191,10 +189,7 @@ impl Suggestion {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
.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();
|
||||||
})
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
if list_items.is_empty() {
|
if list_items.is_empty() {
|
||||||
popover.popdown();
|
popover.popdown();
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user