title_bar: Remove dependency on vcs_menu (#21011)

This PR removes the `title_bar` crate's dependency on the `vcs_menu`.

The `vcs_menu::OpenRecent` action now resides at
`zed_actions::branches::OpenRecent`.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-11-21 14:56:02 -05:00 committed by GitHub
parent 6b2f1cc543
commit 4c7b48b35d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 15 additions and 12 deletions

2
Cargo.lock generated
View file

@ -12641,7 +12641,6 @@ dependencies = [
"tree-sitter-md", "tree-sitter-md",
"ui", "ui",
"util", "util",
"vcs_menu",
"windows 0.58.0", "windows 0.58.0",
"workspace", "workspace",
"zed_actions", "zed_actions",
@ -13653,6 +13652,7 @@ dependencies = [
"ui", "ui",
"util", "util",
"workspace", "workspace",
"zed_actions",
] ]
[[package]] [[package]]

View file

@ -44,7 +44,6 @@ story = { workspace = true, optional = true }
theme.workspace = true theme.workspace = true
ui.workspace = true ui.workspace = true
util.workspace = true util.workspace = true
vcs_menu.workspace = true
workspace.workspace = true workspace.workspace = true
zed_actions.workspace = true zed_actions.workspace = true

View file

@ -27,7 +27,6 @@ use ui::{
IconSize, IconWithIndicator, Indicator, PopoverMenu, Tooltip, IconSize, IconWithIndicator, Indicator, PopoverMenu, Tooltip,
}; };
use util::ResultExt; use util::ResultExt;
use vcs_menu::{BranchList, OpenRecent as ToggleVcsMenu};
use workspace::{notifications::NotifyResultExt, Workspace}; use workspace::{notifications::NotifyResultExt, Workspace};
use zed_actions::{OpenBrowser, OpenRecent, OpenRemote}; use zed_actions::{OpenBrowser, OpenRecent, OpenRemote};
@ -442,14 +441,14 @@ impl TitleBar {
.tooltip(move |cx| { .tooltip(move |cx| {
Tooltip::with_meta( Tooltip::with_meta(
"Recent Branches", "Recent Branches",
Some(&ToggleVcsMenu), Some(&zed_actions::branches::OpenRecent),
"Local branches only", "Local branches only",
cx, cx,
) )
}) })
.on_click(move |_, cx| { .on_click(move |_, cx| {
let _ = workspace.update(cx, |this, cx| { let _ = workspace.update(cx, |_this, cx| {
BranchList::open(this, &Default::default(), cx); cx.dispatch_action(zed_actions::branches::OpenRecent.boxed_clone());
}); });
}), }),
) )

View file

@ -18,3 +18,4 @@ project.workspace = true
ui.workspace = true ui.workspace = true
util.workspace = true util.workspace = true
workspace.workspace = true workspace.workspace = true
zed_actions.workspace = true

View file

@ -2,10 +2,9 @@ use anyhow::{anyhow, Context, Result};
use fuzzy::{StringMatch, StringMatchCandidate}; use fuzzy::{StringMatch, StringMatchCandidate};
use git::repository::Branch; use git::repository::Branch;
use gpui::{ use gpui::{
actions, rems, AnyElement, AppContext, AsyncAppContext, DismissEvent, EventEmitter, rems, AnyElement, AppContext, AsyncAppContext, DismissEvent, EventEmitter, FocusHandle,
FocusHandle, FocusableView, InteractiveElement, IntoElement, ParentElement, Render, FocusableView, InteractiveElement, IntoElement, ParentElement, Render, SharedString, Styled,
SharedString, Styled, Subscription, Task, View, ViewContext, VisualContext, WeakView, Subscription, Task, View, ViewContext, VisualContext, WeakView, WindowContext,
WindowContext,
}; };
use picker::{Picker, PickerDelegate}; use picker::{Picker, PickerDelegate};
use project::ProjectPath; use project::ProjectPath;
@ -14,8 +13,7 @@ use ui::{prelude::*, HighlightedLabel, ListItem, ListItemSpacing};
use util::ResultExt; use util::ResultExt;
use workspace::notifications::DetachAndPromptErr; use workspace::notifications::DetachAndPromptErr;
use workspace::{ModalView, Workspace}; use workspace::{ModalView, Workspace};
use zed_actions::branches::OpenRecent;
actions!(branches, [OpenRecent]);
pub fn init(cx: &mut AppContext) { pub fn init(cx: &mut AppContext) {
cx.observe_new_views(|workspace: &mut Workspace, _| { cx.observe_new_views(|workspace: &mut Workspace, _| {

View file

@ -44,6 +44,12 @@ actions!(
] ]
); );
pub mod branches {
use gpui::actions;
actions!(branches, [OpenRecent]);
}
pub mod command_palette { pub mod command_palette {
use gpui::actions; use gpui::actions;