Rename app_state to global in gpui

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-03-17 14:33:01 +01:00
parent 84bacc556f
commit 44d997c00c
24 changed files with 91 additions and 89 deletions

View file

@ -101,7 +101,7 @@ fn main() {
cx.spawn(|mut cx| async move {
while let Some(settings) = settings_rx.next().await {
cx.update(|cx| {
cx.update_app_state(|s, _| *s = settings);
cx.update_global(|s, _| *s = settings);
cx.refresh_windows();
});
}
@ -110,7 +110,7 @@ fn main() {
languages.set_language_server_download_dir(zed::ROOT_PATH.clone());
languages.set_theme(&settings.theme.editor.syntax);
cx.add_app_state(settings);
cx.set_global(settings);
let app_state = Arc::new(AppState {
languages: Arc::new(languages),

View file

@ -18,7 +18,7 @@ fn init_logger() {
pub fn test_app_state(cx: &mut MutableAppContext) -> Arc<AppState> {
let settings = Settings::test(cx);
editor::init(cx);
cx.add_app_state(settings);
cx.set_global(settings);
let themes = ThemeRegistry::new(Assets, cx.font_cache().clone());
let http = FakeHttpClient::with_404_response();
let client = Client::new(http.clone());

View file

@ -43,7 +43,7 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut gpui::MutableAppContext) {
cx.add_global_action(quit);
cx.add_global_action({
move |action: &AdjustBufferFontSize, cx| {
cx.update_app_state::<Settings, _, _>(|settings, cx| {
cx.update_global::<Settings, _, _>(|settings, cx| {
settings.buffer_font_size =
(settings.buffer_font_size + action.0).max(MIN_FONT_SIZE);
cx.refresh_windows();