handle favoriting from the dock popover menu

This commit is contained in:
Ashley Wulber 2022-01-04 16:53:28 -05:00
parent 69b7ab5906
commit 849333df3d
4 changed files with 71 additions and 4 deletions

View file

@ -245,7 +245,15 @@ impl DockPopover {
let self_ = self.clone();
favorite_item.connect_clicked(glib::clone!(@weak dock_object => move |_| {
println!("TODO handling favorite");
let saved = dock_object.property("saved").expect("DockObject must have saved property").get::<bool>().expect("Failed to convert value to bool");
glib::MainContext::default().spawn_local(async move {
if let Some(tx) = TX.get() {
if let Some(name) = dock_object.get_name() {
let _ = tx.send(Event::Favorite((name.into(), !saved))).await;
}
}
});
self_.emit_hide();
}));