Close notification popover on "notification-closed"
This commit is contained in:
parent
e9055e74d9
commit
ec6a0ff366
2 changed files with 10 additions and 1 deletions
|
|
@ -63,6 +63,11 @@ impl NotificationPopover {
|
||||||
notifications.connect_notification_recieved(clone!(@weak obj => move |notification| {
|
notifications.connect_notification_recieved(clone!(@weak obj => move |notification| {
|
||||||
obj.handle_notification(¬ification);
|
obj.handle_notification(¬ification);
|
||||||
}));
|
}));
|
||||||
|
notifications.connect_notification_closed(clone!(@weak obj => move |id| {
|
||||||
|
if obj.inner().notification_widget.id() == Some(id) {
|
||||||
|
obj.popdown();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
obj
|
obj
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ impl ObjectImpl for NotificationWidgetInner {
|
||||||
..set_pixel_size(8);
|
..set_pixel_size(8);
|
||||||
}));
|
}));
|
||||||
..connect_clicked(clone!(@weak obj => move |_| {
|
..connect_clicked(clone!(@weak obj => move |_| {
|
||||||
if let Some(id) = obj.inner().id.get() {
|
if let Some(id) = obj.id() {
|
||||||
obj.inner().notifications.dismiss(id);
|
obj.inner().notifications.dismiss(id);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
@ -106,4 +106,8 @@ impl NotificationWidget {
|
||||||
self.inner().body_label.set_label(¬ification.body);
|
self.inner().body_label.set_label(¬ification.body);
|
||||||
self.inner().id.set(Some(notification.id));
|
self.inner().id.set(Some(notification.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn id(&self) -> Option<NotificationId> {
|
||||||
|
self.inner().id.get()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue