diff --git a/Cargo.lock b/Cargo.lock index 8537c51611..b895cd669e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1062,6 +1062,28 @@ dependencies = [ "workspace", ] +[[package]] +name = "collab_titlebar_item" +version = "0.1.0" +dependencies = [ + "anyhow", + "client", + "clock", + "collections", + "editor", + "futures", + "fuzzy", + "gpui", + "log", + "postage", + "project", + "serde", + "settings", + "theme", + "util", + "workspace", +] + [[package]] name = "collections" version = "0.1.0" @@ -1151,28 +1173,6 @@ dependencies = [ "workspace", ] -[[package]] -name = "contacts_titlebar_item" -version = "0.1.0" -dependencies = [ - "anyhow", - "client", - "clock", - "collections", - "editor", - "futures", - "fuzzy", - "gpui", - "log", - "postage", - "project", - "serde", - "settings", - "theme", - "util", - "workspace", -] - [[package]] name = "context_menu" version = "0.1.0" @@ -7180,11 +7180,11 @@ dependencies = [ "cli", "client", "clock", + "collab_titlebar_item", "collections", "command_palette", "contacts_panel", "contacts_status_item", - "contacts_titlebar_item", "context_menu", "ctor", "diagnostics", diff --git a/crates/contacts_titlebar_item/Cargo.toml b/crates/collab_titlebar_item/Cargo.toml similarity index 95% rename from crates/contacts_titlebar_item/Cargo.toml rename to crates/collab_titlebar_item/Cargo.toml index 771e364218..f165753992 100644 --- a/crates/contacts_titlebar_item/Cargo.toml +++ b/crates/collab_titlebar_item/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "contacts_titlebar_item" +name = "collab_titlebar_item" version = "0.1.0" edition = "2021" [lib] -path = "src/contacts_titlebar_item.rs" +path = "src/collab_titlebar_item.rs" doctest = false [features] diff --git a/crates/contacts_titlebar_item/src/contacts_titlebar_item.rs b/crates/collab_titlebar_item/src/collab_titlebar_item.rs similarity index 95% rename from crates/contacts_titlebar_item/src/contacts_titlebar_item.rs rename to crates/collab_titlebar_item/src/collab_titlebar_item.rs index a32b2923af..c3810992b6 100644 --- a/crates/contacts_titlebar_item/src/contacts_titlebar_item.rs +++ b/crates/collab_titlebar_item/src/collab_titlebar_item.rs @@ -14,29 +14,29 @@ use std::{ops::Range, sync::Arc}; use theme::Theme; use workspace::{FollowNextCollaborator, ToggleFollow, Workspace}; -impl_internal_actions!(contacts_titlebar_item, [ToggleAddContactsPopover]); +impl_internal_actions!(contacts_titlebar_item, [ToggleAddParticipantPopover]); pub fn init(cx: &mut MutableAppContext) { - cx.add_action(ContactsTitlebarItem::toggle_add_contacts_popover); + cx.add_action(CollabTitlebarItem::toggle_add_participant_popover); } #[derive(Clone, PartialEq)] -struct ToggleAddContactsPopover { +struct ToggleAddParticipantPopover { button_rect: RectF, } -pub struct ContactsTitlebarItem { +pub struct CollabTitlebarItem { workspace: WeakViewHandle, _subscriptions: Vec, } -impl Entity for ContactsTitlebarItem { +impl Entity for CollabTitlebarItem { type Event = (); } -impl View for ContactsTitlebarItem { +impl View for CollabTitlebarItem { fn ui_name() -> &'static str { - "ContactsTitlebarItem" + "CollabTitlebarItem" } fn render(&mut self, cx: &mut RenderContext) -> ElementBox { @@ -56,7 +56,7 @@ impl View for ContactsTitlebarItem { } } -impl ContactsTitlebarItem { +impl CollabTitlebarItem { pub fn new(workspace: &ViewHandle, cx: &mut ViewContext) -> Self { let observe_workspace = cx.observe(workspace, |_, _, cx| cx.notify()); Self { @@ -65,9 +65,9 @@ impl ContactsTitlebarItem { } } - fn toggle_add_contacts_popover( + fn toggle_add_participant_popover( &mut self, - _action: &ToggleAddContactsPopover, + _action: &ToggleAddParticipantPopover, _cx: &mut ViewContext, ) { dbg!("!!!!!!!!!"); @@ -84,7 +84,7 @@ impl ContactsTitlebarItem { } Some( - MouseEventHandler::::new(0, cx, |state, _| { + MouseEventHandler::::new(0, cx, |state, _| { let style = theme .workspace .titlebar @@ -104,7 +104,7 @@ impl ContactsTitlebarItem { }) .with_cursor_style(CursorStyle::PointingHand) .on_click(MouseButton::Left, |event, cx| { - cx.dispatch_action(ToggleAddContactsPopover { + cx.dispatch_action(ToggleAddParticipantPopover { button_rect: event.region, }); }) diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index 170f554814..6c2ce8ff07 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -21,13 +21,13 @@ auto_update = { path = "../auto_update" } breadcrumbs = { path = "../breadcrumbs" } chat_panel = { path = "../chat_panel" } cli = { path = "../cli" } +collab_titlebar_item = { path = "../collab_titlebar_item" } collections = { path = "../collections" } command_palette = { path = "../command_palette" } context_menu = { path = "../context_menu" } client = { path = "../client" } clock = { path = "../clock" } contacts_panel = { path = "../contacts_panel" } -contacts_titlebar_item = { path = "../contacts_titlebar_item" } contacts_status_item = { path = "../contacts_status_item" } diagnostics = { path = "../diagnostics" } editor = { path = "../editor" } diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index aa84d6475b..99983c4d6d 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -107,8 +107,8 @@ fn main() { project::Project::init(&client); client::Channel::init(&client); client::init(client.clone(), cx); + collab_titlebar_item::init(cx); command_palette::init(cx); - contacts_titlebar_item::init(cx); editor::init(cx); go_to_line::init(cx); file_finder::init(cx); diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 42bcd6b9bd..26888dc0d7 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -10,10 +10,10 @@ use anyhow::{anyhow, Context, Result}; use assets::Assets; use breadcrumbs::Breadcrumbs; pub use client; +use collab_titlebar_item::CollabTitlebarItem; use collections::VecDeque; pub use contacts_panel; use contacts_panel::ContactsPanel; -use contacts_titlebar_item::ContactsTitlebarItem; pub use editor; use editor::{Editor, MultiBuffer}; use gpui::{ @@ -280,8 +280,8 @@ pub fn initialize_workspace( })); }); - let contacts_titlebar_item = cx.add_view(|cx| ContactsTitlebarItem::new(&workspace_handle, cx)); - workspace.set_titlebar_item(contacts_titlebar_item, cx); + let collab_titlebar_item = cx.add_view(|cx| CollabTitlebarItem::new(&workspace_handle, cx)); + workspace.set_titlebar_item(collab_titlebar_item, cx); let project_panel = ProjectPanel::new(workspace.project().clone(), cx); let contact_panel = cx.add_view(|cx| {