refactor: expose root presentation apis via root context trait
This commit is contained in:
@@ -13,7 +13,7 @@ use signed_state::{Backend, BackendEvent};
|
||||
use ui::common::{h_flex, v_flex};
|
||||
use ui::icons::IconRole;
|
||||
use ui::layout::panel::PanelRow;
|
||||
use ui::layout::root::Root;
|
||||
use ui::layout::root::RootContext as _;
|
||||
use ui::layout::titlebar::Titlebar;
|
||||
use ui::toast::Toast;
|
||||
|
||||
@@ -61,7 +61,7 @@ impl AppRoot {
|
||||
this.open_passphrase(cx);
|
||||
}
|
||||
BackendEvent::Error(message) => {
|
||||
Root::push_toast(Toast::new(message.clone()).icon(IconRole::Warning), cx);
|
||||
cx.toast(Toast::new(message.clone()).icon(IconRole::Warning));
|
||||
}
|
||||
BackendEvent::SignerChanged => {
|
||||
this.workspace.update(cx, |workspace, cx| {
|
||||
@@ -104,7 +104,7 @@ impl AppRoot {
|
||||
}
|
||||
let dialog = PassphraseDialog::new(cx);
|
||||
self.passphrase = Some(dialog.clone());
|
||||
Root::open_dialog(dialog, cx);
|
||||
cx.open_dialog(dialog);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ use ui::button::{Button, ButtonVariant};
|
||||
use ui::command_palette::{Command, CommandPalette, CommandPaletteState};
|
||||
use ui::icons::{Icon, IconRole};
|
||||
use ui::layout::panel::PanelView;
|
||||
use ui::layout::root::Root;
|
||||
use ui::layout::root::RootContext as _;
|
||||
use ui::menu::{Menu, MenuItem};
|
||||
use ui::tabs::{Tab, Tabs, TabsVariant};
|
||||
use ui::tooltip::Tooltip;
|
||||
@@ -82,10 +82,12 @@ impl TitlebarView {
|
||||
let local = LocalReposStore::global(cx);
|
||||
let directory = ProfileDirectory::new(cx);
|
||||
|
||||
let weak = cx.entity().downgrade();
|
||||
Root::open_dialog(Self::new_palette(weak.clone(), window, cx), cx);
|
||||
|
||||
let entity = cx.entity();
|
||||
let weak = entity.downgrade();
|
||||
|
||||
let palette = Self::new_palette(weak.clone(), window, cx);
|
||||
cx.open_palette(palette);
|
||||
|
||||
let mut subscriptions = Vec::new();
|
||||
|
||||
let repository_switcher = cx.new(|cx| {
|
||||
@@ -365,18 +367,20 @@ impl TitlebarView {
|
||||
}
|
||||
|
||||
fn open_settings(&mut self, cx: &mut Context<Self>) {
|
||||
Root::open_dialog(SettingsDialog::new(cx), cx);
|
||||
let dialog = SettingsDialog::new(cx);
|
||||
cx.open_dialog(dialog);
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
fn open_exit(&mut self, cx: &mut Context<Self>) {
|
||||
Root::open_dialog(ExitDialog::new(cx), cx);
|
||||
let dialog = ExitDialog::new(cx);
|
||||
cx.open_dialog(dialog);
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
fn open_create(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
||||
let view = dialogs::create::CreateRepoDialog::new(self.workspace.clone(), window, cx);
|
||||
Root::open_dialog(view, cx);
|
||||
cx.open_dialog(view);
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user