Detailed changes
@@ -3166,8 +3166,8 @@ impl Panel for AgentPanel {
(self.enabled(cx) && AgentSettings::get_global(cx).button).then_some(IconName::ZedAssistant)
}
- fn icon_tooltip(&self, _window: &Window, _cx: &App) -> Option<&'static str> {
- Some("Agent Panel")
+ fn icon_tooltip(&self, _window: &Window, _cx: &App) -> &'static str {
+ "Agent Panel"
}
fn toggle_action(&self) -> Box<dyn Action> {
@@ -2031,8 +2031,8 @@ impl Panel for Sidebar {
(settings.enabled(cx) && settings.button).then_some(IconName::ThreadsSidebarLeftClosed)
}
- fn icon_tooltip(&self, _window: &Window, _cx: &App) -> Option<&'static str> {
- Some("Threads Sidebar")
+ fn icon_tooltip(&self, _window: &Window, _cx: &App) -> &'static str {
+ "Threads Sidebar"
}
fn toggle_action(&self) -> Box<dyn Action> {
@@ -3197,8 +3197,8 @@ impl Panel for CollabPanel {
.then_some(ui::IconName::UserGroup)
}
- fn icon_tooltip(&self, _window: &Window, _cx: &App) -> Option<&'static str> {
- Some("Collab Panel")
+ fn icon_tooltip(&self, _window: &Window, _cx: &App) -> &'static str {
+ "Collab Panel"
}
fn toggle_action(&self) -> Box<dyn gpui::Action> {
@@ -672,8 +672,8 @@ impl Panel for NotificationPanel {
Some(IconName::BellDot)
}
- fn icon_tooltip(&self, _window: &Window, _cx: &App) -> Option<&'static str> {
- Some("Notification Panel")
+ fn icon_tooltip(&self, _window: &Window, _cx: &App) -> &'static str {
+ "Notification Panel"
}
fn icon_label(&self, _window: &Window, cx: &App) -> Option<String> {
@@ -1585,12 +1585,8 @@ impl Panel for DebugPanel {
.then_some(IconName::Debug)
}
- fn icon_tooltip(&self, _window: &Window, cx: &App) -> Option<&'static str> {
- if DebuggerSettings::get_global(cx).button {
- Some("Debug Panel")
- } else {
- None
- }
+ fn icon_tooltip(&self, _window: &Window, _cx: &App) -> &'static str {
+ "Debug Panel"
}
fn toggle_action(&self) -> Box<dyn Action> {
@@ -5734,8 +5734,8 @@ impl Panel for GitPanel {
Some(ui::IconName::GitBranchAlt).filter(|_| GitPanelSettings::get_global(cx).button)
}
- fn icon_tooltip(&self, _window: &Window, _cx: &App) -> Option<&'static str> {
- Some("Git Panel")
+ fn icon_tooltip(&self, _window: &Window, _cx: &App) -> &'static str {
+ "Git Panel"
}
fn toggle_action(&self) -> Box<dyn Action> {
@@ -5023,8 +5023,8 @@ impl Panel for OutlinePanel {
.then_some(IconName::ListTree)
}
- fn icon_tooltip(&self, _window: &Window, _: &App) -> Option<&'static str> {
- Some("Outline Panel")
+ fn icon_tooltip(&self, _window: &Window, _: &App) -> &'static str {
+ "Outline Panel"
}
fn toggle_action(&self) -> Box<dyn Action> {
@@ -7063,8 +7063,8 @@ impl Panel for ProjectPanel {
.then_some(IconName::FileTree)
}
- fn icon_tooltip(&self, _window: &Window, _cx: &App) -> Option<&'static str> {
- Some("Project Panel")
+ fn icon_tooltip(&self, _window: &Window, _cx: &App) -> &'static str {
+ "Project Panel"
}
fn toggle_action(&self) -> Box<dyn Action> {
@@ -1637,8 +1637,8 @@ impl Panel for TerminalPanel {
}
}
- fn icon_tooltip(&self, _window: &Window, _cx: &App) -> Option<&'static str> {
- Some("Terminal Panel")
+ fn icon_tooltip(&self, _window: &Window, _cx: &App) -> &'static str {
+ "Terminal Panel"
}
fn toggle_action(&self) -> Box<dyn gpui::Action> {
@@ -36,7 +36,7 @@ pub trait Panel: Focusable + EventEmitter<PanelEvent> + Render + Sized {
fn size(&self, window: &Window, cx: &App) -> Pixels;
fn set_size(&mut self, size: Option<Pixels>, window: &mut Window, cx: &mut Context<Self>);
fn icon(&self, window: &Window, cx: &App) -> Option<ui::IconName>;
- fn icon_tooltip(&self, window: &Window, cx: &App) -> Option<&'static str>;
+ fn icon_tooltip(&self, window: &Window, cx: &App) -> &'static str;
fn toggle_action(&self) -> Box<dyn Action>;
fn icon_label(&self, _window: &Window, _: &App) -> Option<String> {
None
@@ -76,7 +76,7 @@ pub trait PanelHandle: Send + Sync {
fn size(&self, window: &Window, cx: &App) -> Pixels;
fn set_size(&self, size: Option<Pixels>, window: &mut Window, cx: &mut App);
fn icon(&self, window: &Window, cx: &App) -> Option<ui::IconName>;
- fn icon_tooltip(&self, window: &Window, cx: &App) -> Option<&'static str>;
+ fn icon_tooltip(&self, window: &Window, cx: &App) -> &'static str;
fn toggle_action(&self, window: &Window, cx: &App) -> Box<dyn Action>;
fn icon_label(&self, window: &Window, cx: &App) -> Option<String>;
fn panel_focus_handle(&self, cx: &App) -> FocusHandle;
@@ -160,7 +160,7 @@ where
self.read(cx).icon(window, cx)
}
- fn icon_tooltip(&self, window: &Window, cx: &App) -> Option<&'static str> {
+ fn icon_tooltip(&self, window: &Window, cx: &App) -> &'static str {
self.read(cx).icon_tooltip(window, cx)
}
@@ -265,11 +265,6 @@ struct PanelEntry {
_subscriptions: [Subscription; 3],
}
-pub struct PanelButtons {
- dock: Entity<Dock>,
- _settings_subscription: Subscription,
-}
-
impl Dock {
pub fn new(
position: DockPosition,
@@ -886,6 +881,11 @@ impl Render for Dock {
}
}
+pub struct PanelButtons {
+ dock: Entity<Dock>,
+ _settings_subscription: Subscription,
+}
+
impl PanelButtons {
pub fn new(dock: Entity<Dock>, cx: &mut Context<Self>) -> Self {
cx.observe(&dock, |_, _, cx| cx.notify()).detach();
@@ -915,13 +915,7 @@ impl Render for PanelButtons {
.enumerate()
.filter_map(|(i, entry)| {
let icon = entry.panel.icon(window, cx)?;
- let icon_tooltip = entry
- .panel
- .icon_tooltip(window, cx)
- .ok_or_else(|| {
- anyhow::anyhow!("can't render a panel button without an icon tooltip")
- })
- .log_err()?;
+ let icon_tooltip = entry.panel.icon_tooltip(window, cx);
let name = entry.panel.persistent_name();
let panel = entry.panel.clone();
@@ -1089,8 +1083,8 @@ pub mod test {
None
}
- fn icon_tooltip(&self, _window: &Window, _cx: &App) -> Option<&'static str> {
- None
+ fn icon_tooltip(&self, _window: &Window, _cx: &App) -> &'static str {
+ "Test Panel"
}
fn toggle_action(&self) -> Box<dyn Action> {