Merge MutableAppContext into AppContext

There may have been a good reason for the difference at some point, or I was
still learning Rust. But now it's just &mut AppContext vs &AppContext.
This commit is contained in:
Nathan Sobo 2023-04-06 15:49:03 -06:00
parent dd00966cc6
commit de9bf6dfbd
112 changed files with 882 additions and 1041 deletions

View file

@ -1,4 +1,4 @@
use crate::{Action, App, ForegroundPlatform, MutableAppContext};
use crate::{Action, App, AppContext, ForegroundPlatform};
pub struct Menu<'a> {
pub name: &'a str,
@ -51,7 +51,7 @@ pub enum OsAction {
Redo,
}
impl MutableAppContext {
impl AppContext {
pub fn set_menus(&mut self, menus: Vec<Menu>) {
self.foreground_platform
.set_menus(menus, &self.keystroke_matcher);
@ -77,7 +77,7 @@ pub(crate) fn setup_menu_handlers(foreground_platform: &dyn ForegroundPlatform,
let cx = app.0.clone();
move |action| {
let mut cx = cx.borrow_mut();
if let Some(main_window_id) = cx.cx.platform.main_window_id() {
if let Some(main_window_id) = cx.platform.main_window_id() {
if let Some(view_id) = cx.focused_view_id(main_window_id) {
cx.handle_dispatch_action_from_effect(main_window_id, Some(view_id), action);
return;