parent
3db84c1247
commit
cdee8c7ffd
2 changed files with 6 additions and 8 deletions
|
|
@ -5,20 +5,20 @@ use gpui::{
|
||||||
|
|
||||||
use crate::theme::ActiveTheme as _;
|
use crate::theme::ActiveTheme as _;
|
||||||
|
|
||||||
use super::{DockItemInfo, DockItemState, Panel, PanelEvent};
|
use super::{DockItemState, Panel, PanelEvent};
|
||||||
|
|
||||||
pub(crate) struct InvalidPanel {
|
pub(crate) struct InvalidPanel {
|
||||||
name: SharedString,
|
name: SharedString,
|
||||||
focus_handle: FocusHandle,
|
focus_handle: FocusHandle,
|
||||||
info: DockItemInfo,
|
old_state: DockItemState,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InvalidPanel {
|
impl InvalidPanel {
|
||||||
pub(crate) fn new(name: &str, info: DockItemInfo, cx: &mut WindowContext) -> Self {
|
pub(crate) fn new(name: &str, state: DockItemState, cx: &mut WindowContext) -> Self {
|
||||||
Self {
|
Self {
|
||||||
focus_handle: cx.focus_handle(),
|
focus_handle: cx.focus_handle(),
|
||||||
name: SharedString::from(name.to_owned()),
|
name: SharedString::from(name.to_owned()),
|
||||||
info,
|
old_state: state,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -28,9 +28,7 @@ impl Panel for InvalidPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dump(&self, _cx: &AppContext) -> super::DockItemState {
|
fn dump(&self, _cx: &AppContext) -> super::DockItemState {
|
||||||
let mut state = DockItemState::new(self);
|
self.old_state.clone()
|
||||||
state.info = self.info.clone();
|
|
||||||
state
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl EventEmitter<PanelEvent> for InvalidPanel {}
|
impl EventEmitter<PanelEvent> for InvalidPanel {}
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@ impl DockItemState {
|
||||||
} else {
|
} else {
|
||||||
// Show an invalid panel if the panel is not registered.
|
// Show an invalid panel if the panel is not registered.
|
||||||
Box::new(
|
Box::new(
|
||||||
cx.new_view(|cx| InvalidPanel::new(&self.panel_name, info.clone(), cx)),
|
cx.new_view(|cx| InvalidPanel::new(&self.panel_name, self.clone(), cx)),
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue