diff --git a/crates/story/src/button_story.rs b/crates/story/src/button_story.rs index fdbaa98d..d2d57b40 100644 --- a/crates/story/src/button_story.rs +++ b/crates/story/src/button_story.rs @@ -50,7 +50,7 @@ impl super::Story for ButtonStory { "Displays a button or a component that looks like a button." } - fn closeable() -> bool { + fn closable() -> bool { false } diff --git a/crates/story/src/input_story.rs b/crates/story/src/input_story.rs index 9d793cfb..8ee53352 100644 --- a/crates/story/src/input_story.rs +++ b/crates/story/src/input_story.rs @@ -55,7 +55,7 @@ impl super::Story for InputStory { "Input" } - fn closeable() -> bool { + fn closable() -> bool { false } diff --git a/crates/story/src/lib.rs b/crates/story/src/lib.rs index 86cad165..d5804017 100644 --- a/crates/story/src/lib.rs +++ b/crates/story/src/lib.rs @@ -100,7 +100,7 @@ pub fn init(cx: &mut AppContext) { }; let view = cx.new_view(|cx| { - let (title, description, closeable, zoomable, story) = story_state.to_story(cx); + let (title, description, closable, zoomable, story) = story_state.to_story(cx); let mut container = StoryContainer::new(cx).story(story, story_state.story_klass); cx.on_focus_in(&container.focus_handle, |this: &mut StoryContainer, _| { @@ -110,7 +110,7 @@ pub fn init(cx: &mut AppContext) { container.name = title.into(); container.description = description.into(); - container.closeable = closeable; + container.closable = closable; container.zoomable = zoomable; container }); @@ -146,7 +146,7 @@ pub struct StoryContainer { height: Option, story: Option, story_klass: Option, - closeable: bool, + closable: bool, zoomable: bool, } @@ -164,7 +164,7 @@ pub trait Story: FocusableView { fn description() -> &'static str { "" } - fn closeable() -> bool { + fn closable() -> bool { true } fn zoomable() -> bool { @@ -191,7 +191,7 @@ impl StoryContainer { height: None, story: None, story_klass: None, - closeable: true, + closable: true, zoomable: true, } } @@ -206,7 +206,7 @@ impl StoryContainer { let view = cx.new_view(|cx| { let mut story = Self::new(cx).story(story.into(), story_klass); story.focus_handle = focus_handle; - story.closeable = S::closeable(); + story.closable = S::closable(); story.zoomable = S::zoomable(); story.name = name.into(); story.description = description.into(); @@ -266,7 +266,7 @@ impl StoryState { ( $klass::title(), $klass::description(), - $klass::closeable(), + $klass::closable(), $klass::zoomable(), $klass::view(cx).into(), ) @@ -320,8 +320,8 @@ impl Panel for StoryContainer { } } - fn closeable(&self, _cx: &AppContext) -> bool { - self.closeable + fn closable(&self, _cx: &AppContext) -> bool { + self.closable } fn zoomable(&self, _cx: &AppContext) -> bool { diff --git a/crates/story/src/table_story.rs b/crates/story/src/table_story.rs index b5c68b83..df3ed703 100644 --- a/crates/story/src/table_story.rs +++ b/crates/story/src/table_story.rs @@ -505,7 +505,7 @@ impl super::Story for TableStory { Self::view(cx) } - fn closeable() -> bool { + fn closable() -> bool { false } } diff --git a/crates/ui/src/dock/dock.rs b/crates/ui/src/dock/dock.rs index 62f66682..b0127c39 100644 --- a/crates/ui/src/dock/dock.rs +++ b/crates/ui/src/dock/dock.rs @@ -81,7 +81,7 @@ impl Dock { ) -> Self { let panel = cx.new_view(|cx| { let mut tab = TabPanel::new(None, dock_area.clone(), cx); - tab.closeable = false; + tab.closable = false; tab }); diff --git a/crates/ui/src/dock/panel.rs b/crates/ui/src/dock/panel.rs index 7798f94d..c7f9425c 100644 --- a/crates/ui/src/dock/panel.rs +++ b/crates/ui/src/dock/panel.rs @@ -52,7 +52,7 @@ pub trait Panel: EventEmitter + FocusableView { /// Whether the panel can be closed, default is `true`. /// /// This method called in Panel render, we should make sure it is fast. - fn closeable(&self, cx: &AppContext) -> bool { + fn closable(&self, cx: &AppContext) -> bool { true } @@ -107,7 +107,7 @@ pub trait PanelView: 'static + Send + Sync { fn panel_name(&self, cx: &AppContext) -> &'static str; fn title(&self, cx: &WindowContext) -> AnyElement; fn title_style(&self, cx: &AppContext) -> Option; - fn closeable(&self, cx: &AppContext) -> bool; + fn closable(&self, cx: &AppContext) -> bool; fn zoomable(&self, cx: &AppContext) -> bool; fn visible(&self, cx: &AppContext) -> bool; fn set_active(&self, active: bool, cx: &mut WindowContext); @@ -132,8 +132,8 @@ impl PanelView for View { self.read(cx).title_style(cx) } - fn closeable(&self, cx: &AppContext) -> bool { - self.read(cx).closeable(cx) + fn closable(&self, cx: &AppContext) -> bool { + self.read(cx).closable(cx) } fn zoomable(&self, cx: &AppContext) -> bool { diff --git a/crates/ui/src/dock/tab_panel.rs b/crates/ui/src/dock/tab_panel.rs index d3a29d9d..507a1a34 100644 --- a/crates/ui/src/dock/tab_panel.rs +++ b/crates/ui/src/dock/tab_panel.rs @@ -26,7 +26,7 @@ use super::{ #[derive(Clone, Copy)] struct TabState { - closeable: bool, + closable: bool, zoomable: bool, draggable: bool, droppable: bool, @@ -71,9 +71,9 @@ pub struct TabPanel { stack_panel: Option>, pub(crate) panels: Vec>, pub(crate) active_ix: usize, - /// If this is true, the Panel closeable will follow the active panel's closeable, + /// If this is true, the Panel closable will follow the active panel's closable, /// otherwise this TabPanel will not able to close - pub(crate) closeable: bool, + pub(crate) closable: bool, tab_bar_scroll_handle: ScrollHandle, is_zoomed: bool, @@ -93,13 +93,13 @@ impl Panel for TabPanel { .unwrap_or("Empty Tab".into_any_element()) } - fn closeable(&self, cx: &AppContext) -> bool { - if !self.closeable { + fn closable(&self, cx: &AppContext) -> bool { + if !self.closable { return false; } self.active_panel(cx) - .map(|panel| panel.closeable(cx)) + .map(|panel| panel.closable(cx)) .unwrap_or(false) } @@ -155,7 +155,7 @@ impl TabPanel { will_split_placement: None, is_zoomed: false, is_collapsed: false, - closeable: true, + closable: true, } } @@ -421,7 +421,7 @@ impl TabPanel { }; this.separator().menu(name, Box::new(ToggleZoom)) }) - .when(state.closeable, |this| { + .when(state.closable, |this| { this.separator() .menu(t!("Dock.Close"), Box::new(ClosePanel)) }) @@ -977,13 +977,13 @@ impl Render for TabPanel { fn render(&mut self, cx: &mut ViewContext) -> impl gpui::IntoElement { let focus_handle = self.focus_handle(cx); let mut state = TabState { - closeable: self.closeable(cx), + closable: self.closable(cx), draggable: self.draggable(cx), droppable: self.droppable(cx), zoomable: self.zoomable(cx), }; if !state.draggable { - state.closeable = false; + state.closable = false; } v_flex()