Wire up journal

This commit is contained in:
Joseph T. Lyons 2023-12-25 03:36:54 -05:00
parent 11d3526f10
commit 88d05fd814
2 changed files with 12 additions and 8 deletions

View file

@ -1,6 +1,6 @@
use anyhow::Result;
use chrono::{Datelike, Local, NaiveTime, Timelike};
use gpui::AppContext;
use gpui::{actions, AppContext, ViewContext};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use settings2::Settings;
@ -9,11 +9,9 @@ use std::{
path::{Path, PathBuf},
sync::Arc,
};
use workspace2::AppState;
// use zed::AppState;
use workspace2::{AppState, Workspace};
// todo!();
// actions!(journal, [NewJournalEntry]);
actions!(journal, [NewJournalEntry]);
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)]
pub struct JournalSettings {
@ -55,8 +53,14 @@ impl settings2::Settings for JournalSettings {
pub fn init(_: Arc<AppState>, cx: &mut AppContext) {
JournalSettings::register(cx);
// todo!()
// cx.add_global_action(move |_: &NewJournalEntry, cx| new_journal_entry(app_state.clone(), cx));
cx.observe_new_views(
|workspace: &mut Workspace, _cx: &mut ViewContext<Workspace>| {
workspace.register_action(|workspace, _: &NewJournalEntry, cx| {
new_journal_entry(workspace.app_state().clone(), cx);
});
},
)
.detach();
}
pub fn new_journal_entry(app_state: Arc<AppState>, cx: &mut AppContext) {

View file

@ -215,7 +215,7 @@ fn main() {
vim::init(cx);
terminal_view::init(cx);
// journal2::init(app_state.clone(), cx);
journal::init(app_state.clone(), cx);
language_selector::init(cx);
theme_selector::init(cx);
language_tools::init(cx);