diff --git a/crates/sidebar/src/sidebar.rs b/crates/sidebar/src/sidebar.rs index 65c5b7566cb496cf93ba9da195e16c12c07a8e08..a9e9a0ab1b74a7aea53e380dce555d6b752da955 100644 --- a/crates/sidebar/src/sidebar.rs +++ b/crates/sidebar/src/sidebar.rs @@ -44,7 +44,7 @@ use util::ResultExt as _; use util::path_list::{PathList, SerializedPathList}; use workspace::{ AddFolderToProject, CloseWindow, FocusWorkspaceSidebar, MoveWorkspaceToNewWindow, - MultiWorkspace, MultiWorkspaceEvent, NextProjectGroup, NextThread, Open, PreviousProjectGroup, + MultiWorkspace, MultiWorkspaceEvent, NextProject, NextThread, Open, PreviousProject, PreviousThread, ShowFewerThreads, ShowMoreThreads, Sidebar as WorkspaceSidebar, SidebarSide, ToggleWorkspaceSidebar, Workspace, WorkspaceId, sidebar_side_context_menu, }; @@ -3091,12 +3091,7 @@ impl Sidebar { }) } - fn cycle_project_group_impl( - &mut self, - forward: bool, - window: &mut Window, - cx: &mut Context, - ) { + fn cycle_project_impl(&mut self, forward: bool, window: &mut Window, cx: &mut Context) { let Some(multi_workspace) = self.multi_workspace.upgrade() else { return; }; @@ -3139,22 +3134,17 @@ impl Sidebar { } } - fn on_next_project_group( - &mut self, - _: &NextProjectGroup, - window: &mut Window, - cx: &mut Context, - ) { - self.cycle_project_group_impl(true, window, cx); + fn on_next_project(&mut self, _: &NextProject, window: &mut Window, cx: &mut Context) { + self.cycle_project_impl(true, window, cx); } - fn on_previous_project_group( + fn on_previous_project( &mut self, - _: &PreviousProjectGroup, + _: &PreviousProject, window: &mut Window, cx: &mut Context, ) { - self.cycle_project_group_impl(false, window, cx); + self.cycle_project_impl(false, window, cx); } fn cycle_thread_impl(&mut self, forward: bool, window: &mut Window, cx: &mut Context) { @@ -3847,8 +3837,8 @@ impl WorkspaceSidebar for Sidebar { self.toggle_thread_switcher_impl(select_last, window, cx); } - fn cycle_project_group(&mut self, forward: bool, window: &mut Window, cx: &mut Context) { - self.cycle_project_group_impl(forward, window, cx); + fn cycle_project(&mut self, forward: bool, window: &mut Window, cx: &mut Context) { + self.cycle_project_impl(forward, window, cx); } fn cycle_thread(&mut self, forward: bool, window: &mut Window, cx: &mut Context) { @@ -3954,8 +3944,8 @@ impl Render for Sidebar { .on_action(cx.listener(Self::toggle_archive)) .on_action(cx.listener(Self::focus_sidebar_filter)) .on_action(cx.listener(Self::on_toggle_thread_switcher)) - .on_action(cx.listener(Self::on_next_project_group)) - .on_action(cx.listener(Self::on_previous_project_group)) + .on_action(cx.listener(Self::on_next_project)) + .on_action(cx.listener(Self::on_previous_project)) .on_action(cx.listener(Self::on_next_thread)) .on_action(cx.listener(Self::on_previous_thread)) .on_action(cx.listener(Self::on_show_more_threads)) diff --git a/crates/workspace/src/multi_workspace.rs b/crates/workspace/src/multi_workspace.rs index 8c0cf287bff8fd0a8ace8a484de031884b3b99f7..672397ae2b7c02894a0866e6e5793964941f88fd 100644 --- a/crates/workspace/src/multi_workspace.rs +++ b/crates/workspace/src/multi_workspace.rs @@ -39,10 +39,10 @@ actions!( CloseWorkspaceSidebar, /// Moves focus to or from the workspace sidebar without closing it. FocusWorkspaceSidebar, - /// Activates the next project group in the sidebar. - NextProjectGroup, - /// Activates the previous project group in the sidebar. - PreviousProjectGroup, + /// Activates the next project in the sidebar. + NextProject, + /// Activates the previous project in the sidebar. + PreviousProject, /// Activates the next thread in sidebar order. NextThread, /// Activates the previous thread in sidebar order. @@ -128,14 +128,8 @@ pub trait Sidebar: Focusable + Render + EventEmitter + Sized { ) { } - /// Activates the next or previous project group. - fn cycle_project_group( - &mut self, - _forward: bool, - _window: &mut Window, - _cx: &mut Context, - ) { - } + /// Activates the next or previous project. + fn cycle_project(&mut self, _forward: bool, _window: &mut Window, _cx: &mut Context) {} /// Activates the next or previous thread in sidebar order. fn cycle_thread(&mut self, _forward: bool, _window: &mut Window, _cx: &mut Context) {} @@ -168,7 +162,7 @@ pub trait SidebarHandle: 'static + Send + Sync { fn to_any(&self) -> AnyView; fn entity_id(&self) -> EntityId; fn toggle_thread_switcher(&self, select_last: bool, window: &mut Window, cx: &mut App); - fn cycle_project_group(&self, forward: bool, window: &mut Window, cx: &mut App); + fn cycle_project(&self, forward: bool, window: &mut Window, cx: &mut App); fn cycle_thread(&self, forward: bool, window: &mut Window, cx: &mut App); fn move_workspace_to_new_window(&self, window: &mut Window, cx: &mut App); @@ -231,11 +225,11 @@ impl SidebarHandle for Entity { }); } - fn cycle_project_group(&self, forward: bool, window: &mut Window, cx: &mut App) { + fn cycle_project(&self, forward: bool, window: &mut Window, cx: &mut App) { let entity = self.clone(); window.defer(cx, move |window, cx| { entity.update(cx, |this, cx| { - this.cycle_project_group(forward, window, cx); + this.cycle_project(forward, window, cx); }); }); } @@ -1517,20 +1511,18 @@ impl Render for MultiWorkspace { } }, )) + .on_action(cx.listener(|this: &mut Self, _: &NextProject, window, cx| { + if let Some(sidebar) = &this.sidebar { + sidebar.cycle_project(true, window, cx); + } + })) .on_action( - cx.listener(|this: &mut Self, _: &NextProjectGroup, window, cx| { + cx.listener(|this: &mut Self, _: &PreviousProject, window, cx| { if let Some(sidebar) = &this.sidebar { - sidebar.cycle_project_group(true, window, cx); + sidebar.cycle_project(false, window, cx); } }), ) - .on_action(cx.listener( - |this: &mut Self, _: &PreviousProjectGroup, window, cx| { - if let Some(sidebar) = &this.sidebar { - sidebar.cycle_project_group(false, window, cx); - } - }, - )) .on_action(cx.listener(|this: &mut Self, _: &NextThread, window, cx| { if let Some(sidebar) = &this.sidebar { sidebar.cycle_thread(true, window, cx); diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index ba25f8abda6dbb9cfe58fc8be542f593bbba183a..82080ab38c0d864ff6accdd91c79dc546bd0a0ec 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -32,10 +32,9 @@ pub use crate::notifications::NotificationFrame; pub use dock::Panel; pub use multi_workspace::{ CloseWorkspaceSidebar, DraggedSidebar, FocusWorkspaceSidebar, MoveWorkspaceToNewWindow, - MultiWorkspace, MultiWorkspaceEvent, NewThread, NextProjectGroup, NextThread, - PreviousProjectGroup, PreviousThread, ShowFewerThreads, ShowMoreThreads, Sidebar, SidebarEvent, - SidebarHandle, SidebarRenderState, SidebarSide, ToggleWorkspaceSidebar, - sidebar_side_context_menu, + MultiWorkspace, MultiWorkspaceEvent, NewThread, NextProject, NextThread, PreviousProject, + PreviousThread, ShowFewerThreads, ShowMoreThreads, Sidebar, SidebarEvent, SidebarHandle, + SidebarRenderState, SidebarSide, ToggleWorkspaceSidebar, sidebar_side_context_menu, }; pub use path_list::{PathList, SerializedPathList}; pub use toast_layer::{ToastAction, ToastLayer, ToastView};