Start moving terminal modal into dock UI

This commit is contained in:
Mikayla Maki 2022-09-06 17:35:56 -07:00 committed by K Simmons
parent 0fca4d02ec
commit 39d219c898
3 changed files with 12 additions and 14 deletions

View file

@ -19,27 +19,25 @@ use gpui::{AnyModelHandle, Entity, ModelHandle, View, ViewContext};
/// This struct is going to be the starting point for the 'program manager' feature that will
/// eventually be implemented to provide a collaborative way of engaging with identity-having
/// features like the terminal.
pub struct ProgramManager {
pub struct Dock {
// TODO: Make this a hashset or something
modals: HashMap<usize, AnyModelHandle>,
}
impl ProgramManager {
impl Dock {
pub fn insert_or_replace<T: Entity, V: View>(
window: usize,
program: ModelHandle<T>,
cx: &mut ViewContext<V>,
) -> Option<AnyModelHandle> {
cx.update_global::<ProgramManager, _, _>(|pm, _| {
pm.insert_or_replace_internal::<T>(window, program)
})
cx.update_global::<Dock, _, _>(|pm, _| pm.insert_or_replace_internal::<T>(window, program))
}
pub fn remove<T: Entity, V: View>(
window: usize,
cx: &mut ViewContext<V>,
) -> Option<ModelHandle<T>> {
cx.update_global::<ProgramManager, _, _>(|pm, _| pm.remove_internal::<T>(window))
cx.update_global::<Dock, _, _>(|pm, _| pm.remove_internal::<T>(window))
}
pub fn new() -> Self {

View file

@ -37,7 +37,7 @@ use log::error;
pub use pane::*;
pub use pane_group::*;
use postage::prelude::Stream;
use programs::ProgramManager;
use programs::Dock;
use project::{fs, Fs, Project, ProjectEntryId, ProjectPath, ProjectStore, Worktree, WorktreeId};
use searchable::SearchableItemHandle;
use serde::Deserialize;
@ -147,7 +147,7 @@ impl_actions!(workspace, [ToggleProjectOnline, ActivatePane]);
pub fn init(app_state: Arc<AppState>, cx: &mut MutableAppContext) {
// Initialize the program manager immediately
cx.set_global(ProgramManager::new());
cx.set_global(Dock::new());
pane::init(cx);