diff --git a/crates/workspace/src/notifications.rs b/crates/workspace/src/notifications.rs index 49cd2b67674500b0cbe3783c68ce04839f8cd53a..d54ec8bf9dd14dd2eaa95ba07dd1414b4f23aa06 100644 --- a/crates/workspace/src/notifications.rs +++ b/crates/workspace/src/notifications.rs @@ -191,6 +191,11 @@ impl Workspace { self.dismiss_notification(id, cx); } + pub fn clear_all_notifications(&mut self, cx: &mut ViewContext) { + self.notifications.clear(); + cx.notify(); + } + fn dismiss_notification_internal(&mut self, id: &NotificationId, cx: &mut ViewContext) { self.notifications.retain(|(existing_id, _)| { if existing_id == id { diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 7bcf3113009a6e810181a477296a87587c30c24a..acdf294aac7795057a5a0bdeb4b869018093829b 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -115,6 +115,7 @@ actions!( ActivateNextPane, ActivatePreviousPane, AddFolderToProject, + ClearAllNotifications, CloseAllDocks, CloseWindow, Feedback, @@ -3896,6 +3897,11 @@ impl Workspace { workspace.close_all_docks(cx); }), ) + .on_action( + cx.listener(|workspace: &mut Workspace, _: &ClearAllNotifications, cx| { + workspace.clear_all_notifications(cx); + }), + ) .on_action(cx.listener(Workspace::open)) .on_action(cx.listener(Workspace::close_window)) .on_action(cx.listener(Workspace::activate_pane_at_index))