Port to gpui2

This commit is contained in:
Kirill Bulatov
2023-12-05 16:13:39 +02:00
parent e5616bce98
commit 16b5d4b35c
17 changed files with 2585 additions and 355 deletions
+10 -7
View File
@@ -537,18 +537,21 @@ impl Pane {
pub(crate) fn open_item(
&mut self,
project_entry_id: ProjectEntryId,
project_entry_id: Option<ProjectEntryId>,
focus_item: bool,
cx: &mut ViewContext<Self>,
build_item: impl FnOnce(&mut ViewContext<Pane>) -> Box<dyn ItemHandle>,
) -> Box<dyn ItemHandle> {
let mut existing_item = None;
for (index, item) in self.items.iter().enumerate() {
if item.is_singleton(cx) && item.project_entry_ids(cx).as_slice() == [project_entry_id]
{
let item = item.boxed_clone();
existing_item = Some((index, item));
break;
if let Some(project_entry_id) = project_entry_id {
for (index, item) in self.items.iter().enumerate() {
if item.is_singleton(cx)
&& item.project_entry_ids(cx).as_slice() == [project_entry_id]
{
let item = item.boxed_clone();
existing_item = Some((index, item));
break;
}
}
}
+3 -3
View File
@@ -10,7 +10,7 @@ mod persistence;
pub mod searchable;
// todo!()
mod modal_layer;
mod shared_screen;
pub mod shared_screen;
mod status_bar;
mod toolbar;
mod workspace_settings;
@@ -1853,13 +1853,13 @@ impl Workspace {
})
}
pub(crate) fn load_path(
fn load_path(
&mut self,
path: ProjectPath,
cx: &mut ViewContext<Self>,
) -> Task<
Result<(
ProjectEntryId,
Option<ProjectEntryId>,
impl 'static + Send + FnOnce(&mut ViewContext<Pane>) -> Box<dyn ItemHandle>,
)>,
> {