Wire up journal
This commit is contained in:
parent
11d3526f10
commit
88d05fd814
2 changed files with 12 additions and 8 deletions
|
@ -1,6 +1,6 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use chrono::{Datelike, Local, NaiveTime, Timelike};
|
use chrono::{Datelike, Local, NaiveTime, Timelike};
|
||||||
use gpui::AppContext;
|
use gpui::{actions, AppContext, ViewContext};
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use settings2::Settings;
|
use settings2::Settings;
|
||||||
|
@ -9,11 +9,9 @@ use std::{
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
};
|
};
|
||||||
use workspace2::AppState;
|
use workspace2::{AppState, Workspace};
|
||||||
// use zed::AppState;
|
|
||||||
|
|
||||||
// todo!();
|
actions!(journal, [NewJournalEntry]);
|
||||||
// actions!(journal, [NewJournalEntry]);
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)]
|
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)]
|
||||||
pub struct JournalSettings {
|
pub struct JournalSettings {
|
||||||
|
@ -55,8 +53,14 @@ impl settings2::Settings for JournalSettings {
|
||||||
pub fn init(_: Arc<AppState>, cx: &mut AppContext) {
|
pub fn init(_: Arc<AppState>, cx: &mut AppContext) {
|
||||||
JournalSettings::register(cx);
|
JournalSettings::register(cx);
|
||||||
|
|
||||||
// todo!()
|
cx.observe_new_views(
|
||||||
// cx.add_global_action(move |_: &NewJournalEntry, cx| new_journal_entry(app_state.clone(), cx));
|
|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) {
|
pub fn new_journal_entry(app_state: Arc<AppState>, cx: &mut AppContext) {
|
||||||
|
|
|
@ -215,7 +215,7 @@ fn main() {
|
||||||
vim::init(cx);
|
vim::init(cx);
|
||||||
terminal_view::init(cx);
|
terminal_view::init(cx);
|
||||||
|
|
||||||
// journal2::init(app_state.clone(), cx);
|
journal::init(app_state.clone(), cx);
|
||||||
language_selector::init(cx);
|
language_selector::init(cx);
|
||||||
theme_selector::init(cx);
|
theme_selector::init(cx);
|
||||||
language_tools::init(cx);
|
language_tools::init(cx);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue