Rename contacts_titlebar_item to collab_titlebar_item

This commit is contained in:
Antonio Scandurra 2022-09-27 13:51:21 +02:00
parent 5a3a85b2c8
commit 782309f369
6 changed files with 42 additions and 42 deletions

46
Cargo.lock generated
View file

@ -1062,6 +1062,28 @@ dependencies = [
"workspace", "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]] [[package]]
name = "collections" name = "collections"
version = "0.1.0" version = "0.1.0"
@ -1151,28 +1173,6 @@ dependencies = [
"workspace", "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]] [[package]]
name = "context_menu" name = "context_menu"
version = "0.1.0" version = "0.1.0"
@ -7180,11 +7180,11 @@ dependencies = [
"cli", "cli",
"client", "client",
"clock", "clock",
"collab_titlebar_item",
"collections", "collections",
"command_palette", "command_palette",
"contacts_panel", "contacts_panel",
"contacts_status_item", "contacts_status_item",
"contacts_titlebar_item",
"context_menu", "context_menu",
"ctor", "ctor",
"diagnostics", "diagnostics",

View file

@ -1,10 +1,10 @@
[package] [package]
name = "contacts_titlebar_item" name = "collab_titlebar_item"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
[lib] [lib]
path = "src/contacts_titlebar_item.rs" path = "src/collab_titlebar_item.rs"
doctest = false doctest = false
[features] [features]

View file

@ -14,29 +14,29 @@ use std::{ops::Range, sync::Arc};
use theme::Theme; use theme::Theme;
use workspace::{FollowNextCollaborator, ToggleFollow, Workspace}; 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) { 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)] #[derive(Clone, PartialEq)]
struct ToggleAddContactsPopover { struct ToggleAddParticipantPopover {
button_rect: RectF, button_rect: RectF,
} }
pub struct ContactsTitlebarItem { pub struct CollabTitlebarItem {
workspace: WeakViewHandle<Workspace>, workspace: WeakViewHandle<Workspace>,
_subscriptions: Vec<Subscription>, _subscriptions: Vec<Subscription>,
} }
impl Entity for ContactsTitlebarItem { impl Entity for CollabTitlebarItem {
type Event = (); type Event = ();
} }
impl View for ContactsTitlebarItem { impl View for CollabTitlebarItem {
fn ui_name() -> &'static str { fn ui_name() -> &'static str {
"ContactsTitlebarItem" "CollabTitlebarItem"
} }
fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox { fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {
@ -56,7 +56,7 @@ impl View for ContactsTitlebarItem {
} }
} }
impl ContactsTitlebarItem { impl CollabTitlebarItem {
pub fn new(workspace: &ViewHandle<Workspace>, cx: &mut ViewContext<Self>) -> Self { pub fn new(workspace: &ViewHandle<Workspace>, cx: &mut ViewContext<Self>) -> Self {
let observe_workspace = cx.observe(workspace, |_, _, cx| cx.notify()); let observe_workspace = cx.observe(workspace, |_, _, cx| cx.notify());
Self { Self {
@ -65,9 +65,9 @@ impl ContactsTitlebarItem {
} }
} }
fn toggle_add_contacts_popover( fn toggle_add_participant_popover(
&mut self, &mut self,
_action: &ToggleAddContactsPopover, _action: &ToggleAddParticipantPopover,
_cx: &mut ViewContext<Self>, _cx: &mut ViewContext<Self>,
) { ) {
dbg!("!!!!!!!!!"); dbg!("!!!!!!!!!");
@ -84,7 +84,7 @@ impl ContactsTitlebarItem {
} }
Some( Some(
MouseEventHandler::<ToggleAddContactsPopover>::new(0, cx, |state, _| { MouseEventHandler::<ToggleAddParticipantPopover>::new(0, cx, |state, _| {
let style = theme let style = theme
.workspace .workspace
.titlebar .titlebar
@ -104,7 +104,7 @@ impl ContactsTitlebarItem {
}) })
.with_cursor_style(CursorStyle::PointingHand) .with_cursor_style(CursorStyle::PointingHand)
.on_click(MouseButton::Left, |event, cx| { .on_click(MouseButton::Left, |event, cx| {
cx.dispatch_action(ToggleAddContactsPopover { cx.dispatch_action(ToggleAddParticipantPopover {
button_rect: event.region, button_rect: event.region,
}); });
}) })

View file

@ -21,13 +21,13 @@ auto_update = { path = "../auto_update" }
breadcrumbs = { path = "../breadcrumbs" } breadcrumbs = { path = "../breadcrumbs" }
chat_panel = { path = "../chat_panel" } chat_panel = { path = "../chat_panel" }
cli = { path = "../cli" } cli = { path = "../cli" }
collab_titlebar_item = { path = "../collab_titlebar_item" }
collections = { path = "../collections" } collections = { path = "../collections" }
command_palette = { path = "../command_palette" } command_palette = { path = "../command_palette" }
context_menu = { path = "../context_menu" } context_menu = { path = "../context_menu" }
client = { path = "../client" } client = { path = "../client" }
clock = { path = "../clock" } clock = { path = "../clock" }
contacts_panel = { path = "../contacts_panel" } contacts_panel = { path = "../contacts_panel" }
contacts_titlebar_item = { path = "../contacts_titlebar_item" }
contacts_status_item = { path = "../contacts_status_item" } contacts_status_item = { path = "../contacts_status_item" }
diagnostics = { path = "../diagnostics" } diagnostics = { path = "../diagnostics" }
editor = { path = "../editor" } editor = { path = "../editor" }

View file

@ -107,8 +107,8 @@ fn main() {
project::Project::init(&client); project::Project::init(&client);
client::Channel::init(&client); client::Channel::init(&client);
client::init(client.clone(), cx); client::init(client.clone(), cx);
collab_titlebar_item::init(cx);
command_palette::init(cx); command_palette::init(cx);
contacts_titlebar_item::init(cx);
editor::init(cx); editor::init(cx);
go_to_line::init(cx); go_to_line::init(cx);
file_finder::init(cx); file_finder::init(cx);

View file

@ -10,10 +10,10 @@ use anyhow::{anyhow, Context, Result};
use assets::Assets; use assets::Assets;
use breadcrumbs::Breadcrumbs; use breadcrumbs::Breadcrumbs;
pub use client; pub use client;
use collab_titlebar_item::CollabTitlebarItem;
use collections::VecDeque; use collections::VecDeque;
pub use contacts_panel; pub use contacts_panel;
use contacts_panel::ContactsPanel; use contacts_panel::ContactsPanel;
use contacts_titlebar_item::ContactsTitlebarItem;
pub use editor; pub use editor;
use editor::{Editor, MultiBuffer}; use editor::{Editor, MultiBuffer};
use gpui::{ use gpui::{
@ -280,8 +280,8 @@ pub fn initialize_workspace(
})); }));
}); });
let contacts_titlebar_item = cx.add_view(|cx| ContactsTitlebarItem::new(&workspace_handle, cx)); let collab_titlebar_item = cx.add_view(|cx| CollabTitlebarItem::new(&workspace_handle, cx));
workspace.set_titlebar_item(contacts_titlebar_item, cx); workspace.set_titlebar_item(collab_titlebar_item, cx);
let project_panel = ProjectPanel::new(workspace.project().clone(), cx); let project_panel = ProjectPanel::new(workspace.project().clone(), cx);
let contact_panel = cx.add_view(|cx| { let contact_panel = cx.add_view(|cx| {