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

Release Notes:

- N/A
This commit is contained in:
Mikayla Maki 2025-01-26 20:00:27 -08:00 committed by GitHub
parent a6b1514246
commit 9cae96f82f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
115 changed files with 309 additions and 311 deletions

View file

@ -204,7 +204,7 @@ impl ChannelView {
cx: &mut Context<Self>,
) -> Self {
let buffer = channel_buffer.read(cx).buffer();
let this = cx.model().downgrade();
let this = cx.entity().downgrade();
let editor = cx.new(|cx| {
let mut editor = Editor::for_buffer(buffer, None, window, cx);
editor.set_collaboration_hub(Box::new(ChannelBufferCollaborationHub(

View file

@ -97,7 +97,7 @@ impl ChatPanel {
});
cx.new(|cx| {
let model = cx.model().downgrade();
let model = cx.entity().downgrade();
let message_list = ListState::new(
0,
gpui::ListAlignment::Bottom,
@ -680,7 +680,7 @@ impl ChatPanel {
})
})
.when_some(message_id, |el, message_id| {
let this = cx.model().clone();
let this = cx.entity().clone();
el.child(
self.render_popover_button(

View file

@ -101,7 +101,7 @@ impl MessageEditor {
window: &mut Window,
cx: &mut Context<Self>,
) -> Self {
let this = cx.model().downgrade();
let this = cx.entity().downgrade();
editor.update(cx, |editor, cx| {
editor.set_soft_wrap_mode(SoftWrap::EditorWidth, cx);
editor.set_use_autoclose(false);

View file

@ -73,7 +73,7 @@ pub fn init(cx: &mut App) {
.and_then(|room| room.read(cx).channel_id());
if let Some(channel_id) = channel_id {
let workspace = cx.model().clone();
let workspace = cx.entity().clone();
window.defer(cx, move |window, cx| {
ChannelView::open(channel_id, None, workspace, window, cx)
.detach_and_log_err(cx)
@ -239,7 +239,7 @@ impl CollabPanel {
)
.detach();
let model = cx.model().downgrade();
let model = cx.entity().downgrade();
let list_state = ListState::new(
0,
gpui::ListAlignment::Top,
@ -1040,7 +1040,7 @@ impl CollabPanel {
window: &mut Window,
cx: &mut Context<Self>,
) {
let this = cx.model().clone();
let this = cx.entity().clone();
if !(role == proto::ChannelRole::Guest
|| role == proto::ChannelRole::Talker
|| role == proto::ChannelRole::Member)
@ -1170,7 +1170,7 @@ impl CollabPanel {
.channel_for_id(clipboard.channel_id)
.map(|channel| channel.name.clone())
});
let this = cx.model().clone();
let this = cx.entity().clone();
let context_menu = ContextMenu::build(window, cx, |mut context_menu, window, cx| {
if self.has_subchannels(ix) {
@ -1337,7 +1337,7 @@ impl CollabPanel {
window: &mut Window,
cx: &mut Context<Self>,
) {
let this = cx.model().clone();
let this = cx.entity().clone();
let in_room = ActiveCall::global(cx).read(cx).room().is_some();
let context_menu = ContextMenu::build(window, cx, |mut context_menu, _, _| {

View file

@ -40,7 +40,7 @@ impl ChannelModal {
cx: &mut Context<Self>,
) -> Self {
cx.observe(&channel_store, |_, _, cx| cx.notify()).detach();
let channel_modal = cx.model().downgrade();
let channel_modal = cx.entity().downgrade();
let picker = cx.new(|cx| {
Picker::uniform_list(
ChannelModalDelegate {
@ -581,7 +581,7 @@ impl ChannelModalDelegate {
return;
};
let user_id = membership.user.id;
let picker = cx.model().clone();
let picker = cx.entity().clone();
let context_menu = ContextMenu::build(window, cx, |mut menu, _window, _cx| {
let role = membership.role;

View file

@ -16,7 +16,7 @@ pub struct ContactFinder {
impl ContactFinder {
pub fn new(user_store: Entity<UserStore>, window: &mut Window, cx: &mut Context<Self>) -> Self {
let delegate = ContactFinderDelegate {
parent: cx.model().downgrade(),
parent: cx.entity().downgrade(),
user_store,
potential_contacts: Arc::from([]),
selected_index: 0,

View file

@ -110,7 +110,7 @@ impl NotificationPanel {
})
.detach();
let model = cx.model().downgrade();
let model = cx.entity().downgrade();
let notification_list =
ListState::new(0, ListAlignment::Top, px(1000.), move |ix, window, cx| {
model
@ -323,7 +323,7 @@ impl NotificationPanel {
.justify_end()
.child(Button::new("decline", "Decline").on_click({
let notification = notification.clone();
let model = cx.model().clone();
let model = cx.entity().clone();
move |_, _, cx| {
model.update(cx, |this, cx| {
this.respond_to_notification(
@ -336,7 +336,7 @@ impl NotificationPanel {
}))
.child(Button::new("accept", "Accept").on_click({
let notification = notification.clone();
let model = cx.model().clone();
let model = cx.entity().clone();
move |_, _, cx| {
model.update(cx, |this, cx| {
this.respond_to_notification(
@ -570,7 +570,7 @@ impl NotificationPanel {
workspace.dismiss_notification(&id, cx);
workspace.show_notification(id, cx, |cx| {
let workspace = cx.model().downgrade();
let workspace = cx.entity().downgrade();
cx.new(|_| NotificationToast {
notification_id,
actor,