Detailed changes
@@ -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<Self>,
- ) {
+ fn cycle_project_impl(&mut self, forward: bool, window: &mut Window, cx: &mut Context<Self>) {
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>,
- ) {
- self.cycle_project_group_impl(true, window, cx);
+ fn on_next_project(&mut self, _: &NextProject, window: &mut Window, cx: &mut Context<Self>) {
+ 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>,
) {
- 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<Self>) {
@@ -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>) {
- self.cycle_project_group_impl(forward, window, cx);
+ fn cycle_project(&mut self, forward: bool, window: &mut Window, cx: &mut Context<Self>) {
+ self.cycle_project_impl(forward, window, cx);
}
fn cycle_thread(&mut self, forward: bool, window: &mut Window, cx: &mut Context<Self>) {
@@ -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))
@@ -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<SidebarEvent> + Sized {
) {
}
- /// Activates the next or previous project group.
- fn cycle_project_group(
- &mut self,
- _forward: bool,
- _window: &mut Window,
- _cx: &mut Context<Self>,
- ) {
- }
+ /// Activates the next or previous project.
+ fn cycle_project(&mut self, _forward: bool, _window: &mut Window, _cx: &mut Context<Self>) {}
/// Activates the next or previous thread in sidebar order.
fn cycle_thread(&mut self, _forward: bool, _window: &mut Window, _cx: &mut Context<Self>) {}
@@ -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<T: Sidebar> SidebarHandle for Entity<T> {
});
}
- 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);
@@ -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};