Add button to close notification

This commit is contained in:
Ian Douglas Scott 2021-09-13 13:48:17 -07:00
parent e0d1224173
commit a82c0a5577
4 changed files with 67 additions and 15 deletions

View file

@ -31,19 +31,12 @@ impl ObjectImpl for NotificationPopoverInner {
}));
});
let notification_widget = cascade! {
NotificationWidget::new();
};
cascade! {
obj;
..set_autohide(false);
..set_has_arrow(false);
..set_offset(0, 12);
..set_child(Some(&notification_widget));
};
self.notification_widget.set(notification_widget);
}
}
@ -59,6 +52,12 @@ impl NotificationPopover {
pub fn new(notifications: &Notifications) -> Self {
let obj = glib::Object::new::<Self>(&[]).unwrap();
let notification_widget = cascade! {
NotificationWidget::new(notifications);
};
obj.set_child(Some(&notification_widget));
obj.inner().notification_widget.set(notification_widget);
// XXX disconnect?
obj.inner().notifications.set(notifications.clone());
notifications.connect_notification_recieved(clone!(@weak obj => move |notification| {