Remove more references to 'model' in GPUI APIs (#23693)

Release Notes:

- N/A
This commit is contained in:
Mikayla Maki
2025-01-27 04:00:27 +00:00
committed by GitHub
parent a6b1514246
commit 9cae96f82f
115 changed files with 309 additions and 311 deletions
+1 -1
View File
@@ -724,7 +724,7 @@ fn handle_open_request(request: OpenRequest, app_state: Arc<AppState>, cx: &mut
let workspace_window =
workspace::get_any_active_workspace(app_state, cx.clone()).await?;
let workspace = workspace_window.root_model(&cx)?;
let workspace = workspace_window.entity(&cx)?;
let mut promises = Vec::new();
for (channel_id, heading) in request.open_channel_notes {
+4 -4
View File
@@ -143,7 +143,7 @@ pub fn initialize_workspace(
return;
};
let workspace_handle = cx.model().clone();
let workspace_handle = cx.entity().clone();
let center_pane = workspace.active_pane().clone();
initialize_pane(workspace, &center_pane, window, cx);
cx.subscribe_in(&workspace_handle, window, {
@@ -214,7 +214,7 @@ pub fn initialize_workspace(
auto_update_ui::notify_of_any_new_update(window, cx);
let handle = cx.model().downgrade();
let handle = cx.entity().downgrade();
window.on_window_should_close(cx, move |window, cx| {
handle
.update(cx, |workspace, cx| {
@@ -1221,7 +1221,7 @@ fn show_keymap_file_load_error(
let parsed_markdown = Rc::new(parsed_markdown.await);
cx.update(|cx| {
show_app_notification(notification_id, cx, move |cx| {
let workspace_handle = cx.model().downgrade();
let workspace_handle = cx.entity().downgrade();
let parsed_markdown = parsed_markdown.clone();
cx.new(move |_cx| {
MessageNotification::new_from_builder(move |window, cx| {
@@ -2574,7 +2574,7 @@ mod tests {
.unwrap();
assert_eq!(
opened_workspace.root_model(cx).unwrap().entity_id(),
opened_workspace.root(cx).unwrap().entity_id(),
workspace.entity_id(),
"Excluded files in subfolders of a workspace root should be opened in the workspace"
);
@@ -29,7 +29,7 @@ pub fn init(client: Arc<Client>, user_store: Entity<UserStore>, cx: &mut App) {
return;
};
let editor_handle = cx.model().downgrade();
let editor_handle = cx.entity().downgrade();
cx.on_release({
let editor_handle = editor_handle.clone();
let editors = editors.clone();
@@ -115,9 +115,8 @@ pub fn init(client: Arc<Client>, user_store: Entity<UserStore>, cx: &mut App) {
return;
};
let Some(workspace) = window
.downcast::<Workspace>()
.and_then(|w| w.root_model(cx).ok())
let Some(workspace) =
window.downcast::<Workspace>().and_then(|w| w.root(cx).ok())
else {
return;
};