Put context parameter last in toggle_modal callback
This is more consistent with our treatment of context params everywhere else.
This commit is contained in:
parent
6b5cab5db1
commit
9c68c3e8a9
8 changed files with 9 additions and 9 deletions
|
@ -71,7 +71,7 @@ impl CommandPalette {
|
||||||
cx.as_mut().defer(move |cx| {
|
cx.as_mut().defer(move |cx| {
|
||||||
let this = cx.add_view(window_id, |cx| Self::new(focused_view_id, cx));
|
let this = cx.add_view(window_id, |cx| Self::new(focused_view_id, cx));
|
||||||
workspace.update(cx, |workspace, cx| {
|
workspace.update(cx, |workspace, cx| {
|
||||||
workspace.toggle_modal(cx, |cx, _| {
|
workspace.toggle_modal(cx, |_, cx| {
|
||||||
cx.subscribe(&this, Self::on_event).detach();
|
cx.subscribe(&this, Self::on_event).detach();
|
||||||
this
|
this
|
||||||
});
|
});
|
||||||
|
|
|
@ -159,7 +159,7 @@ impl PickerDelegate for ContactFinder {
|
||||||
|
|
||||||
impl ContactFinder {
|
impl ContactFinder {
|
||||||
fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>) {
|
fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>) {
|
||||||
workspace.toggle_modal(cx, |cx, workspace| {
|
workspace.toggle_modal(cx, |workspace, cx| {
|
||||||
let finder = cx.add_view(|cx| Self::new(workspace.user_store().clone(), cx));
|
let finder = cx.add_view(|cx| Self::new(workspace.user_store().clone(), cx));
|
||||||
cx.subscribe(&finder, Self::on_event).detach();
|
cx.subscribe(&finder, Self::on_event).detach();
|
||||||
finder
|
finder
|
||||||
|
|
|
@ -85,7 +85,7 @@ impl FileFinder {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>) {
|
fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>) {
|
||||||
workspace.toggle_modal(cx, |cx, workspace| {
|
workspace.toggle_modal(cx, |workspace, cx| {
|
||||||
let project = workspace.project().clone();
|
let project = workspace.project().clone();
|
||||||
let finder = cx.add_view(|cx| Self::new(project, cx));
|
let finder = cx.add_view(|cx| Self::new(project, cx));
|
||||||
cx.subscribe(&finder, Self::on_event).detach();
|
cx.subscribe(&finder, Self::on_event).detach();
|
||||||
|
|
|
@ -62,7 +62,7 @@ impl GoToLine {
|
||||||
.active_item(cx)
|
.active_item(cx)
|
||||||
.and_then(|active_item| active_item.downcast::<Editor>())
|
.and_then(|active_item| active_item.downcast::<Editor>())
|
||||||
{
|
{
|
||||||
workspace.toggle_modal(cx, |cx, _| {
|
workspace.toggle_modal(cx, |_, cx| {
|
||||||
let view = cx.add_view(|cx| GoToLine::new(editor, cx));
|
let view = cx.add_view(|cx| GoToLine::new(editor, cx));
|
||||||
cx.subscribe(&view, Self::on_event).detach();
|
cx.subscribe(&view, Self::on_event).detach();
|
||||||
view
|
view
|
||||||
|
|
|
@ -87,7 +87,7 @@ impl OutlineView {
|
||||||
.read(cx)
|
.read(cx)
|
||||||
.outline(Some(cx.global::<Settings>().theme.editor.syntax.as_ref()));
|
.outline(Some(cx.global::<Settings>().theme.editor.syntax.as_ref()));
|
||||||
if let Some(outline) = buffer {
|
if let Some(outline) = buffer {
|
||||||
workspace.toggle_modal(cx, |cx, _| {
|
workspace.toggle_modal(cx, |_, cx| {
|
||||||
let view = cx.add_view(|cx| OutlineView::new(outline, editor, cx));
|
let view = cx.add_view(|cx| OutlineView::new(outline, editor, cx));
|
||||||
cx.subscribe(&view, Self::on_event).detach();
|
cx.subscribe(&view, Self::on_event).detach();
|
||||||
view
|
view
|
||||||
|
|
|
@ -71,7 +71,7 @@ impl ProjectSymbolsView {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>) {
|
fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>) {
|
||||||
workspace.toggle_modal(cx, |cx, workspace| {
|
workspace.toggle_modal(cx, |workspace, cx| {
|
||||||
let project = workspace.project().clone();
|
let project = workspace.project().clone();
|
||||||
let symbols = cx.add_view(|cx| Self::new(project, cx));
|
let symbols = cx.add_view(|cx| Self::new(project, cx));
|
||||||
cx.subscribe(&symbols, Self::on_event).detach();
|
cx.subscribe(&symbols, Self::on_event).detach();
|
||||||
|
|
|
@ -66,7 +66,7 @@ impl ThemeSelector {
|
||||||
|
|
||||||
fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>) {
|
fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>) {
|
||||||
let themes = workspace.themes();
|
let themes = workspace.themes();
|
||||||
workspace.toggle_modal(cx, |cx, _| {
|
workspace.toggle_modal(cx, |_, cx| {
|
||||||
let this = cx.add_view(|cx| Self::new(themes, cx));
|
let this = cx.add_view(|cx| Self::new(themes, cx));
|
||||||
cx.subscribe(&this, Self::on_event).detach();
|
cx.subscribe(&this, Self::on_event).detach();
|
||||||
this
|
this
|
||||||
|
|
|
@ -943,7 +943,7 @@ impl Workspace {
|
||||||
) -> Option<ViewHandle<V>>
|
) -> Option<ViewHandle<V>>
|
||||||
where
|
where
|
||||||
V: 'static + View,
|
V: 'static + View,
|
||||||
F: FnOnce(&mut ViewContext<Self>, &mut Self) -> ViewHandle<V>,
|
F: FnOnce(&mut Self, &mut ViewContext<Self>) -> ViewHandle<V>,
|
||||||
{
|
{
|
||||||
cx.notify();
|
cx.notify();
|
||||||
// Whatever modal was visible is getting clobbered. If its the same type as V, then return
|
// Whatever modal was visible is getting clobbered. If its the same type as V, then return
|
||||||
|
@ -953,7 +953,7 @@ impl Workspace {
|
||||||
cx.focus_self();
|
cx.focus_self();
|
||||||
Some(already_open_modal)
|
Some(already_open_modal)
|
||||||
} else {
|
} else {
|
||||||
let modal = add_view(cx, self);
|
let modal = add_view(self, cx);
|
||||||
cx.focus(&modal);
|
cx.focus(&modal);
|
||||||
self.modal = Some(modal.into());
|
self.modal = Some(modal.into());
|
||||||
None
|
None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue