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",
]
[[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",

View File

@ -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]

View File

@ -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<Workspace>,
_subscriptions: Vec<Subscription>,
}
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<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 {
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<Self>,
) {
dbg!("!!!!!!!!!");
@ -84,7 +84,7 @@ impl ContactsTitlebarItem {
}
Some(
MouseEventHandler::<ToggleAddContactsPopover>::new(0, cx, |state, _| {
MouseEventHandler::<ToggleAddParticipantPopover>::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,
});
})

View File

@ -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" }

View File

@ -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);

View File

@ -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| {