Remove more references to 'model' in GPUI APIs (#23693)
Release Notes: - N/A
This commit is contained in:
parent
a6b1514246
commit
9cae96f82f
115 changed files with 309 additions and 311 deletions
|
@ -240,7 +240,7 @@ impl Dock {
|
|||
cx: &mut Context<Workspace>,
|
||||
) -> Entity<Self> {
|
||||
let focus_handle = cx.focus_handle();
|
||||
let workspace = cx.model().clone();
|
||||
let workspace = cx.entity().clone();
|
||||
let dock = cx.new(|cx| {
|
||||
let focus_subscription =
|
||||
cx.on_focus(&focus_handle, window, |dock: &mut Dock, window, cx| {
|
||||
|
|
|
@ -265,7 +265,7 @@ impl Render for LanguageServerPrompt {
|
|||
)
|
||||
.child(Label::new(request.message.to_string()).size(LabelSize::Small))
|
||||
.children(request.actions.iter().enumerate().map(|(ix, action)| {
|
||||
let this_handle = cx.model().clone();
|
||||
let this_handle = cx.entity().clone();
|
||||
Button::new(ix, action.title.clone())
|
||||
.size(ButtonSize::Large)
|
||||
.on_click(move |_, window, cx| {
|
||||
|
|
|
@ -396,7 +396,7 @@ impl Pane {
|
|||
cx.subscribe(&project, Self::project_events),
|
||||
];
|
||||
|
||||
let handle = cx.model().downgrade();
|
||||
let handle = cx.entity().downgrade();
|
||||
Self {
|
||||
alternate_file_items: (None, None),
|
||||
focus_handle,
|
||||
|
@ -756,7 +756,7 @@ impl Pane {
|
|||
|
||||
fn navigate_backward(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
||||
if let Some(workspace) = self.workspace.upgrade() {
|
||||
let pane = cx.model().downgrade();
|
||||
let pane = cx.entity().downgrade();
|
||||
window.defer(cx, move |window, cx| {
|
||||
workspace.update(cx, |workspace, cx| {
|
||||
workspace.go_back(pane, window, cx).detach_and_log_err(cx)
|
||||
|
@ -767,7 +767,7 @@ impl Pane {
|
|||
|
||||
fn navigate_forward(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
||||
if let Some(workspace) = self.workspace.upgrade() {
|
||||
let pane = cx.model().downgrade();
|
||||
let pane = cx.entity().downgrade();
|
||||
window.defer(cx, move |window, cx| {
|
||||
workspace.update(cx, |workspace, cx| {
|
||||
workspace
|
||||
|
@ -1992,7 +1992,7 @@ impl Pane {
|
|||
|
||||
fn update_status_bar(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
||||
let workspace = self.workspace.clone();
|
||||
let pane = cx.model().clone();
|
||||
let pane = cx.entity().clone();
|
||||
|
||||
window.defer(cx, move |window, cx| {
|
||||
let Ok(status_bar) = workspace.update(cx, |workspace, _| workspace.status_bar.clone())
|
||||
|
@ -2044,7 +2044,7 @@ impl Pane {
|
|||
|
||||
fn pin_tab_at(&mut self, ix: usize, window: &mut Window, cx: &mut Context<Self>) {
|
||||
maybe!({
|
||||
let pane = cx.model().clone();
|
||||
let pane = cx.entity().clone();
|
||||
let destination_index = self.pinned_tab_count.min(ix);
|
||||
self.pinned_tab_count += 1;
|
||||
let id = self.item_for_index(ix)?.item_id();
|
||||
|
@ -2067,7 +2067,7 @@ impl Pane {
|
|||
|
||||
fn unpin_tab_at(&mut self, ix: usize, window: &mut Window, cx: &mut Context<Self>) {
|
||||
maybe!({
|
||||
let pane = cx.model().clone();
|
||||
let pane = cx.entity().clone();
|
||||
self.pinned_tab_count = self.pinned_tab_count.checked_sub(1)?;
|
||||
let destination_index = self.pinned_tab_count;
|
||||
|
||||
|
@ -2214,7 +2214,7 @@ impl Pane {
|
|||
.on_drag(
|
||||
DraggedTab {
|
||||
item: item.boxed_clone(),
|
||||
pane: cx.model().clone(),
|
||||
pane: cx.entity().clone(),
|
||||
detail,
|
||||
is_active,
|
||||
ix,
|
||||
|
@ -2328,7 +2328,7 @@ impl Pane {
|
|||
};
|
||||
|
||||
let is_pinned = self.is_tab_pinned(ix);
|
||||
let pane = cx.model().downgrade();
|
||||
let pane = cx.entity().downgrade();
|
||||
let menu_context = item.item_focus_handle(cx);
|
||||
right_click_menu(ix).trigger(tab).menu(move |window, cx| {
|
||||
let pane = pane.clone();
|
||||
|
@ -2534,7 +2534,7 @@ impl Pane {
|
|||
let navigate_backward = IconButton::new("navigate_backward", IconName::ArrowLeft)
|
||||
.icon_size(IconSize::Small)
|
||||
.on_click({
|
||||
let model = cx.model().clone();
|
||||
let model = cx.entity().clone();
|
||||
move |_, window, cx| model.update(cx, |pane, cx| pane.navigate_backward(window, cx))
|
||||
})
|
||||
.disabled(!self.can_navigate_backward())
|
||||
|
@ -2548,7 +2548,7 @@ impl Pane {
|
|||
let navigate_forward = IconButton::new("navigate_forward", IconName::ArrowRight)
|
||||
.icon_size(IconSize::Small)
|
||||
.on_click({
|
||||
let model = cx.model().clone();
|
||||
let model = cx.entity().clone();
|
||||
move |_, window, cx| model.update(cx, |pane, cx| pane.navigate_forward(window, cx))
|
||||
})
|
||||
.disabled(!self.can_navigate_forward())
|
||||
|
@ -2732,7 +2732,7 @@ impl Pane {
|
|||
return;
|
||||
}
|
||||
}
|
||||
let mut to_pane = cx.model().clone();
|
||||
let mut to_pane = cx.entity().clone();
|
||||
let split_direction = self.drag_split_direction;
|
||||
let item_id = dragged_tab.item.item_id();
|
||||
if let Some(preview_item_id) = self.preview_item_id {
|
||||
|
@ -2821,7 +2821,7 @@ impl Pane {
|
|||
return;
|
||||
}
|
||||
}
|
||||
let mut to_pane = cx.model().clone();
|
||||
let mut to_pane = cx.entity().clone();
|
||||
let split_direction = self.drag_split_direction;
|
||||
let project_entry_id = *project_entry_id;
|
||||
self.workspace
|
||||
|
@ -2895,7 +2895,7 @@ impl Pane {
|
|||
return;
|
||||
}
|
||||
}
|
||||
let mut to_pane = cx.model().clone();
|
||||
let mut to_pane = cx.entity().clone();
|
||||
let mut split_direction = self.drag_split_direction;
|
||||
let paths = paths.paths().to_vec();
|
||||
let is_remote = self
|
||||
|
@ -3246,7 +3246,7 @@ impl Render for Pane {
|
|||
MouseButton::Navigate(NavigationDirection::Back),
|
||||
cx.listener(|pane, _, window, cx| {
|
||||
if let Some(workspace) = pane.workspace.upgrade() {
|
||||
let pane = cx.model().downgrade();
|
||||
let pane = cx.entity().downgrade();
|
||||
window.defer(cx, move |window, cx| {
|
||||
workspace.update(cx, |workspace, cx| {
|
||||
workspace.go_back(pane, window, cx).detach_and_log_err(cx)
|
||||
|
@ -3259,7 +3259,7 @@ impl Render for Pane {
|
|||
MouseButton::Navigate(NavigationDirection::Forward),
|
||||
cx.listener(|pane, _, window, cx| {
|
||||
if let Some(workspace) = pane.workspace.upgrade() {
|
||||
let pane = cx.model().downgrade();
|
||||
let pane = cx.entity().downgrade();
|
||||
window.defer(cx, move |window, cx| {
|
||||
workspace.update(cx, |workspace, cx| {
|
||||
workspace
|
||||
|
|
|
@ -699,7 +699,7 @@ impl PaneAxis {
|
|||
basis,
|
||||
self.flexes.clone(),
|
||||
self.bounding_boxes.clone(),
|
||||
cx.model().downgrade(),
|
||||
cx.entity().downgrade(),
|
||||
)
|
||||
.children(self.members.iter().enumerate().map(|(ix, member)| {
|
||||
if member.contains(active_pane) {
|
||||
|
|
|
@ -941,7 +941,7 @@ impl Workspace {
|
|||
})
|
||||
.detach();
|
||||
|
||||
let weak_handle = cx.model().downgrade();
|
||||
let weak_handle = cx.entity().downgrade();
|
||||
let pane_history_timestamp = Arc::new(AtomicUsize::new(0));
|
||||
|
||||
let center_pane = cx.new(|cx| {
|
||||
|
@ -1216,7 +1216,7 @@ impl Workspace {
|
|||
}
|
||||
let window = if let Some(window) = requesting_window {
|
||||
cx.update_window(window.into(), |_, window, cx| {
|
||||
window.replace_root_model(cx, |window, cx| {
|
||||
window.replace_root(cx, |window, cx| {
|
||||
Workspace::new(
|
||||
Some(workspace_id),
|
||||
project_handle.clone(),
|
||||
|
@ -4962,7 +4962,7 @@ impl Workspace {
|
|||
}
|
||||
|
||||
pub fn for_window(window: &mut Window, _: &mut App) -> Option<Entity<Workspace>> {
|
||||
window.root_model().flatten()
|
||||
window.root().flatten()
|
||||
}
|
||||
|
||||
pub fn zoomed_item(&self) -> Option<&AnyWeakView> {
|
||||
|
@ -5265,7 +5265,7 @@ impl Render for Workspace {
|
|||
.border_b_1()
|
||||
.border_color(colors.border)
|
||||
.child({
|
||||
let this = cx.model().clone();
|
||||
let this = cx.entity().clone();
|
||||
canvas(
|
||||
move |bounds, window, cx| {
|
||||
this.update(cx, |this, cx| {
|
||||
|
@ -5477,8 +5477,8 @@ impl WorkspaceStore {
|
|||
Self {
|
||||
workspaces: Default::default(),
|
||||
_subscriptions: vec![
|
||||
client.add_request_handler(cx.weak_model(), Self::handle_follow),
|
||||
client.add_message_handler(cx.weak_model(), Self::handle_update_followers),
|
||||
client.add_request_handler(cx.weak_entity(), Self::handle_follow),
|
||||
client.add_message_handler(cx.weak_entity(), Self::handle_update_followers),
|
||||
],
|
||||
client,
|
||||
}
|
||||
|
@ -6146,7 +6146,7 @@ pub fn open_ssh_project(
|
|||
}
|
||||
|
||||
cx.update_window(window.into(), |_, window, cx| {
|
||||
window.replace_root_model(cx, |window, cx| {
|
||||
window.replace_root(cx, |window, cx| {
|
||||
let mut workspace =
|
||||
Workspace::new(Some(workspace_id), project, app_state.clone(), window, cx);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue