Initial code for listing notifications

This commit is contained in:
Ian Douglas Scott 2021-09-09 13:05:24 -07:00
parent 14dc25985a
commit db70daa238
6 changed files with 197 additions and 51 deletions

View file

@ -382,13 +382,16 @@ impl Notifications {
self.inner().notifications.borrow().get(&id).cloned()
}
pub fn connect_notification_recieved<F: Fn(NotificationId) + 'static>(
pub fn connect_notification_recieved<F: Fn(Rc<Notification>) + 'static>(
&self,
cb: F,
) -> SignalHandlerId {
self.connect_local("notification-received", false, move |values| {
let obj = values[0].get::<Self>().unwrap();
let id = values[1].get().unwrap();
cb(id);
if let Some(notification) = obj.get(id) {
cb(notification);
}
None
})
.unwrap()